Skip to content

Conversation

itingliu
Copy link
Contributor

We wrongly returned the entire pref dictionary instead of the demanded value.

I did not want to spend too much time adding a test since this is dependent on the the autoupdating current locale. I did verify the following test failed before but passed after the fix.

- (void)test24HourOverride {
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setLocale:[NSLocale autoupdatingCurrentLocale]];
    [formatter setLocalizedDateFormatFromTemplate:@"Jmm"];

    NSString *dateFormat = formatter.dateFormat;
    XCTAssertEqualObjects(dateFormat, @"HH:mm");
}

…ows 12 hour format)

We wrongly returned the entire pref dictionary instead of the demanded value.

I did not want to spend too much time adding a test since this is dependent on the the autoupdating current locale. I did verify the following test failed before but passed after the fix.

```Obj-C
- (void)test24HourOverride {
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setLocale:[NSLocale autoupdatingCurrentLocale]];
    [formatter setLocalizedDateFormatFromTemplate:@"Jmm"];

    NSString *dateFormat = formatter.dateFormat;
    XCTAssertEqualObjects(dateFormat, @"HH:mm");
}
```
@itingliu
Copy link
Contributor Author

@swift-ci please test

@itingliu itingliu requested a review from parkera October 25, 2023 23:22
@iCharlesHu
Copy link
Contributor

Linux failure is fixed in swiftlang/swift-syntax#2312

Hopefully we'll get a new snapshot soon

@itingliu itingliu merged commit 9d196fd into swiftlang:main Oct 26, 2023
@itingliu itingliu deleted the locale-autoupdating-pref branch October 26, 2023 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants