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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions babel/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1656,10 +1656,10 @@ def get_week_number(self, day_of_period: int, day_of_week: int | None = None) ->
# If the weeknumber exceeds the maximum number of weeks for the given year
# we must count from zero.For example the above calculation gives week 53
# for 2018-12-31. By iso-calender definition 2018 has a max of 52
# weeks, thus the weeknumber must be 53-52=1.
# weeks, thus the weeknumber must be 53-1=52.
max_weeks = datetime.date(year=self.value.year, day=28, month=12).isocalendar()[1]
if week_number > max_weeks:
week_number -= max_weeks
week_number -= 1

return week_number

Expand Down