[issue15873] datetime: add ability to parse RFC 3339 dates and times

Elvis Pranskevichus report at bugs.python.org
Tue Oct 24 19:44:49 EDT 2017


Elvis Pranskevichus <elvis at magic.io> added the comment:

I think that both the pyiso8601 and boxed/iso8601 implementations parse ISO 8601 strings incorrectly.  The standard explicitly says that all truncated datetime strings are *reduced accuracy timestamps*.  In other words, "2017-10" is *not* equal to "2017-10-01".  Instead, "2017-10" represents the whole month of October 2017.  Same thing with hours.  Earlier versions of ISO 8601 even allowed dropping the year: "--10-01", which meant October 1st of _any year_.  They dropped this from more recent revisions of the standard.

The only place where the truncated representation means "default to zero" is the timezone offset, so "10:10:00+4" and "10:10:00+04:00" mean the same thing.

----------
nosy: +Elvis.Pranskevichus

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue15873>
_______________________________________


More information about the Python-bugs-list mailing list