website/datoer.py

13 lines
325 B
Python
Raw Permalink Normal View History

2024-04-14 14:29:36 +00:00
import sys
import calendar
year = 2024
if len(sys.argv) > 1:
try:
year = int(sys.argv[-1])
except ValueError:
pass
for month in range(1, 13):
last_sunday = max(week[-1] for week in calendar.monthcalendar(year, month))
print('{}-{}-{:2}'.format(year, calendar.month_abbr[month], last_sunday))