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 belopolsky
Recipients belopolsky, mirkovogt, r.david.murray
Date 2015-01-27.18:47:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1422384469.17.0.980483817752.issue23332@psf.upfronthosting.co.za>
In-reply-to
Content
Do I understand correctly that the request is to append '+00:00' to the result of dt.isoformat() when dt is naive?  If so, -1.  Python's datetime module does not dictate how naive datetime instances should be interpreted.  UTC by default and local by default are both valid choices, but local by default is often preferable.  There are at least two reasons for that:

1. Local time is the "naïve" time.  Using UTC implies certain amount of sophistication.

2. Interpreting naive times as UTC is unnecessary because it is very easy to create aware instances with tzinfo=timezone.utc.

When communicating with javascript and in general when writing software for the Internet, I recommend using aware datetime instances.  For example,

>>> from datetime import *
>>> datetime.now(timezone.utc).isoformat()
'2015-01-27T18:27:33.216857+00:00'
History
Date User Action Args
2015-01-27 18:47:49belopolskysetrecipients: + belopolsky, r.david.murray, mirkovogt
2015-01-27 18:47:49belopolskysetmessageid: <1422384469.17.0.980483817752.issue23332@psf.upfronthosting.co.za>
2015-01-27 18:47:49belopolskylinkissue23332 messages
2015-01-27 18:47:48belopolskycreate