This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jeanCarloMachado
Recipients docs@python, jeanCarloMachado
Date 2022-01-20.21:16:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642713376.42.0.598006047552.issue46447@roundup.psfhosted.org>
In-reply-to
Content
datetime.utcnow() already present a warning box describing the risk of using it without specifying timezone information. However, one might still have the same problem and never encounter this warning information by doing datetime.now().isoformat(). Or just by not reading the docs of datetime.utcnow, just the datetime.isoformat docs.

By adding a similar warning to the datetime.isoformat() we could make the risk clearer and reduce the likelihood of errors. Is when calling isoformat() where people get confident to be producing ISO's.

I just recently had an incident in my company where we produced naive datetimes using datetime.now() and serialized them using isoformat() while expecting them to be a transferrable ISO format. Nevertheless, the other system read the dates without Z in the end and interpreted it as local time.

If you agree that this suggestion could be a good improvement to the docs, I can send a patch in the next 2 weeks.
History
Date User Action Args
2022-01-20 21:16:16jeanCarloMachadosetrecipients: + jeanCarloMachado, docs@python
2022-01-20 21:16:16jeanCarloMachadosetmessageid: <1642713376.42.0.598006047552.issue46447@roundup.psfhosted.org>
2022-01-20 21:16:16jeanCarloMachadolinkissue46447 messages
2022-01-20 21:16:16jeanCarloMachadocreate