Skip to content
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

Changed get_week_number() to fix a problem with the locale en_AU #1146

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

RomainBarbason
Copy link

This is my first pull-request ever, so don't hesitate to give me feedback on anything

If my analysis is correct, get_week_number() made it impossible for iso-calendar to show their last week, because the week_number was fixed from 53 to 1, while it should be fixed to 52.
That's why the year wasn't updated and the result was "W1 2023", it should be "W52 2023".

Hope this helps !

Fixes #1133

@tomasr8
Copy link
Member

tomasr8 commented Nov 6, 2024

Thanks for the PR! Do you think you could add some tests for this fix? Somewhere here might be a good place:

babel/tests/test_dates.py

Lines 715 to 720 in 313277a

def test_datetime_format_get_week_number():
format = dates.DateTimeFormat(date(2006, 1, 8), Locale.parse('de_DE'))
assert format.get_week_number(6) == 1
format = dates.DateTimeFormat(date(2006, 1, 8), Locale.parse('en_US'))
assert format.get_week_number(6) == 2

@akx
Copy link
Member

akx commented Nov 10, 2024

Yep, as Tomas said, a test would be very much appreciated - the week numbering logic seems to be pretty finicky all in all...

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.

issue with en_AU locale
3 participants