Skip to content

Commit

Permalink
Changed explanation for get_week_number()
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainBarbason committed Nov 5, 2024
1 parent 11eb9e9 commit 476b34f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion babel/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,7 @@ 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 -= 1
Expand Down

0 comments on commit 476b34f

Please sign in to comment.