3 ms·
I'd say that wouldn't enforcement be rather simple going forwards since you could just enforce that dt.tzinfo == datetime.timezone.utc, but as far as I know, ti
by Hamuko 3y ago
I'd say that wouldn't enforcement be rather simple going forwards since you could just enforce that dt.tzinfo == datetime.timezone.utc, but as far as I know, timezone information checking in Python can be a bit of a pain.
>>> utc1 = datetime.timezone.utc
>>> utc2 = zoneinfo.ZoneInfo("UTC")
>>> utc1 == utc2
False
>>> dt1 = datetime.datetime.now(utc1)
>>> dt2 = datetime.datetime.now(utc2)
>>> dt1.tzinfo == dt2.tzinfo
False