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
Weeknumber wrong for 2018-12-31 #619
Comments
It's entirely possible the code is broken (and it does seem to be, unfortunately). We would gladly accept a PR fixing this, if you're up for it. The relevant code is Line 1480 in b7dda2a
and it was originally implemented 12 years ago (😅) in 3b3df4b . |
The weeknumber was calculated to 53, but by definition the value must compute to 1. the fix will compute the weeknumber by using date.isocalendar if locale.first_week_day == 0. Also the computation of the year format 'YYYY' is replaced by isocalendar. Tests added.
The weeknumber was calculated to 53, but by definition the value must compute to 1. the fix will compute the weeknumber by using date.isocalendar if locale.first_week_day == 0. Also the computation of the year format 'YYYY' is replaced by isocalendar. Tests added.
Are there any news about this bug? Since Babel is used in Odoo, the weeknumber bug is present there and should be fixed soon. |
The weeknumber was calculated to 53, but by definition the value must compute to 1. the fix will compute the weeknumber by using date.isocalendar if locale.first_week_day == 0. Also the computation of the year format 'YYYY' is replaced by isocalendar.
Odoo uses a previous version of babel (namely the 2.3.4) we do not update dependencies on stable version. Hopefully this fix will be part of a coming babel release and be part of the next Odoo stable version (namely v13). |
As mentioned in the docs babel.dates.format_date uses the ISO-Calendar when passing "YYYY" as format string.
Evaluating gives
The correct result should be 1 2019 by iso definitions.
Thanks for your reply
The text was updated successfully, but these errors were encountered: