Skip to content
Snippets Groups Projects
Commit 1871c8c1 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch...

Merge branch '5-problems-with-dates-in-the-new-year-but-in-the-last-calendar-week-of-the-old-year' into 'master'

Resolve "Problems with dates which are in the new year, but in the last calendar week of the old year"

Closes #5

See merge request !6
parents f897f5f4 a56407cd
No related branches found
No related tags found
1 merge request!6Resolve "Problems with dates which are in the new year, but in the last calendar week of the old year"
...@@ -64,7 +64,12 @@ class CalendarWeek: ...@@ -64,7 +64,12 @@ class CalendarWeek:
""" Get the calendar week by a date object (the week this date is in). """ """ Get the calendar week by a date object (the week this date is in). """
week = int(when.strftime("%V")) week = int(when.strftime("%V"))
year = when.year + 1 if when.month == 12 and week == 1 else when.year year = when.year
if when.month == 12 and week == 1:
year += 1
elif when.month == 1 and (week == 52 or week == 53):
year -= 1
return cls(year=year, week=week) return cls(year=year, week=week)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment