datetime
datetime has date (a day), datetime (a day and a time) and timedelta
(a length of time).
Do date maths with timedelta, never by hand. Adding timedelta(days=3)
handles month ends and leap years for you. Subtracting two dates gives a
timedelta, and .days gives the whole days in it.
To read text into a datetime, use datetime.strptime(text, format). To turn
one into text, use .strftime(format). The codes are things like %Y (year),
%m (month), %d (day), %H:%M (24 hour time). For ISO text like
2024-03-01T14:30:00, fromisoformat and isoformat need no format at all.
In tests, pass dates in as arguments instead of calling datetime.now()
inside your function. The Testing chapter shows why.
Time zones live in zoneinfo, which does not work in the browser, so this
tour leaves them out.
Run it, then find how many days are left until the end of 2024.