Hi,
I have this test code which started to fail with the latest release of pytz:
assert utc_str(datetime(2020, 1, 1, 0, 0, 0, 0, tzinfo=pytz.timezone("GMT"))) == "2020-01-01T00:00:00Z"
and fails with this error:
E AssertionError: assert '2019-12-31T23:42:00Z' == '2019-12-31T23:00:00Z'
The utc_str function boils down to:
def utc_str(dt: datetime) -> str:
return dt.astimezone(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
It works as expected in pytz 2024.1.
Am I doing something wrong?
Thanks for clarification!
Hi,
I have this test code which started to fail with the latest release of pytz:
and fails with this error:
The
utc_strfunction boils down to:It works as expected in pytz 2024.1.
Am I doing something wrong?
Thanks for clarification!