bpo-46614: Allow datetime.isoformat to use "Z" UTC designator by godlygeek · Pull Request #32041 · python/cpython

@godlygeek

Add an optional parameter to datetime.isoformat() and time.isoformat()
called use_utc_designator. If provided and True and the object is
associated with a tzinfo and its tzname is exactly "UTC", the formatted
UTC offset will be "Z" rather than an offset from UTC.

merwok

mguaypaq added a commit to neuropoly/changelog that referenced this pull request

Nov 30, 2022
See this CPython pull request and the linked discussion for an
explanation of why `replace('Z', '+00:00')` is needed:
python/cpython#32041