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

Mathieu Dupuy report at bugs.python.org
Mon Feb 15 23:26:58 EST 2016


Mathieu Dupuy added the comment:

The real question is : should we accept whatever iso8601 format is common to be found on the internet, or just be able to consume back the string issued by isoformat. From that results the answers to the questions you're asking: don't accept single digits, neither second-less datetime, ...
I don't really mind what the answer is. I'm OK for a stricter acceptance. I would like to ask ourselves : does a simpler, stricter implementation fulfill people needs ? If it's OK for you, it's OK for me.

By taking the Django version, I deviated the bit from the author's original need which was just being able to parse back datetime isoformat. The limitations he raises for not using strptime are gone now (strptime understand timezone), but it still can't understand microseconds nor optional parts (T or space for separator, optional microseconds). Even for a much simpler, stricter implementation, I'd like to stick with regex.

I'll do a date & time version, I just wait that we fall agree on the whole datetime thing.

Wether we change to a simpler code or keep it this way, I can rewrite tests & docstring.

----------

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


More information about the Python-bugs-list mailing list