swiftlang / swift-foundation-icu

Apache License 2.0
61 stars 17 forks source link

Mixed locale is handled incorrectly #49

Open Cyberbeni opened 1 month ago

Cyberbeni commented 1 month ago

Mixed locale (like "en_HU") used to work correctly in iOS 16, got broken in iOS 17 and was fixed in iOS 18 but it is still working incorrectly with the swift:6.0.1 docker container.

Given the following example with "hu" Locale:

let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .long
dateFormatter.timeStyle = .long
dateFormatter.locale = Locale(identifier: "hu")
print(dateFormatter.string(from: now))
// 2024. október 8. 9:22:33 GMT

And then the same with "en_HU" Locale:

let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .long
dateFormatter.timeStyle = .long
dateFormatter.locale = Locale(identifier: "en_HU")
print(dateFormatter.string(from: now))
// 8 October 2024 9:22:33 GMT

I would expect the output to be 2024. October 8. 9:22:33 GMT, so YMD ordering, 24 hour time, English month name. Feedback Assistant ticket for the original issue on iOS: FB13227120 Also had a WWDC lab regarding this issue, don't know if it has a reference number (or if it is already attached internally to the Feedback Assistant issue).

itingliu commented 1 month ago

This is in fact an ICU issue. I'm transferring this to swift-foundation-icu to track the fix here.

itingliu commented 1 month ago

I believe this will be fixed while we upstream the latest ICU update.