-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date formatting prints incorrect year in French locale #56
Comments
Wow -- that's not good. I'll look into it. Thanks for letting me know. |
Just in case you weren't already aware: the That said, the week-based year should only differ from the normal calendar year near calendar year boundaries, so it certainly should not differ on 31 May. There's clearly a bug here. |
Yes, I see the bug. Thanks again! I'll have a fix out soon. |
This has turned out to be rather confusing -- not the bug in my code, which is obvious, but the determination of what the correct behavior should be. The CLDR spec has the following:
This description implies that the determination of the week on which a date falls is parameterized by two locale-specific pieces of data:
In the U.S., the minimum number of days in a week (according to CLDR's data) is 1, and the first day of the week is Sunday. In France the minimum number of days is 4, and the first day of the week is Monday. Therefore, the en_US and fr_FR locales ought to be good test cases for the example mentioned in that text. In en_US, I'd expect that 1997-12-29 would be on the last week of 1997, whereas in fr_FR it would fall on the first week of 1998 (in the localized week-based calendar). However, in both locales, ICU4J reports that it falls on the first week of 1998. This suggests to me that ICU4J isn't using any locale information to render the results and is, instead, simply using ISO 8601 rules (which happen to be the same rules that the French locale uses). So now I'm wondering if my attempt to use locale-specific data for the 'Y' pattern is just wasted effort and if I should, instead, just use the ISO 8601 week-based calendar rules. I'm not really sure if anyone ever uses a week-based calendar other than the ISO one, so it's not obvious to me that this pattern (and the related 'w' pattern) ought to be locale-sensitive. |
Oh -- also, I just noticed from your github info that you're in Quebec. The fr_CA locale would use the same parameters as en_US. |
Interestingly, TwitterCLDR appears to implement the algorithm described in the CLDR spec, but doesn't have the locale-specific parameter data, so it assumes Sunday for the start-of-week and a 1-day minimal week. So it doesn't use ISO 8601 rules. |
Ugh, no -- I misinterpreted the text. ICU4J is following the CLDR spec. Well, good -- then there's no confusion about how this should behave. |
See <97jaz/gregor#56> for details
It looks like
~t
produces incorrect years for some dates when the current locale isfr
.From what I can tell, this happens for May 29th, 30th and 31st of this year. It also happens for the years 2016, 2017, 2021, 2022, and 2023, but works properly in 2015, 2018, 2019, 2020, and 2024.
The text was updated successfully, but these errors were encountered: