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 mirkovogt
Recipients mirkovogt
Date 2015-01-27.17:37:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1422380249.92.0.118157289878.issue23332@psf.upfronthosting.co.za>
In-reply-to
Content
I trapped into a pitfall today with web programming using DateTime.isoformat() in the backend and Javascript on the frontend side.

isoformat() string'yfies a DateTime-object according to ISO 8601, which states that, if no timezone is specified, the string is supposed to be interpreted as UTC implicitly. isoformat() doesn't append any TZ if the object is UTC - so far so good.

However when interacting with JavaScript that leads to errors, as the ECMAScript ed 6 draft states (and most browser act like that): "date time strings without a time zone are to be treated as local, not UTC)."[1]

That is not Python's fault - however considering the issues this behaviour could cause as well as following the philosophy 'explicit is better than implicit', I'd suggest explicitly marking UTC-strings as such by adding a trailing 'Z'. According ISO 8601 that is totally fine, optional though.

[1]https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse
History
Date User Action Args
2015-01-27 17:37:29mirkovogtsetrecipients: + mirkovogt
2015-01-27 17:37:29mirkovogtsetmessageid: <1422380249.92.0.118157289878.issue23332@psf.upfronthosting.co.za>
2015-01-27 17:37:29mirkovogtlinkissue23332 messages
2015-01-27 17:37:29mirkovogtcreate