Message411046
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. |
|
Date |
User |
Action |
Args |
2022-01-20 21:16:16 | jeanCarloMachado | set | recipients:
+ jeanCarloMachado, docs@python |
2022-01-20 21:16:16 | jeanCarloMachado | set | messageid: <1642713376.42.0.598006047552.issue46447@roundup.psfhosted.org> |
2022-01-20 21:16:16 | jeanCarloMachado | link | issue46447 messages |
2022-01-20 21:16:16 | jeanCarloMachado | create | |
|