datetime parsing does not handle generic ISO-8601 strings
See original GitHub issueCurrently the generated from_dict
code calls datetime.fromisoformat()
:
fromisoformat
is only designed to invert the strings generated by datetime.isoformat()
:
This does not support parsing arbitrary ISO 8601 strings - it is only intended as the inverse operation of
datetime.isoformat()
. A more full-featured ISO 8601 parser,dateutil.parser.isoparse
is available in the third-party package dateutil.
According to mashumaro’s documentation:
use_datetime: False # False - load datetime oriented objects from ISO 8601 formatted string, True - keep untouched
I believe it should be within mashumaro’s scope to handle generic ISO-8601 strings
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Generic support for ISO 8601 format in Java 6 - Stack Overflow
Can we parse all the offset formats using the same formatter? When reading mixed data, you don't want to handle each offset format...
Read more >DateTime and DateTimeOffset support in System.Text.Json
NET's extensive support for parsing various DateTime and DateTimeOffset text formats, including non-ISO 8601 strings and ISO 8601 formats ...
Read more >Parsing ISO8601 dates and times - the Tcler's Wiki!
The clock command has always asserted in the documentation of its free-form parser that it is capable of parsing ISO 8601 date/time strings....
Read more >15 Formatting and Parsing - Racket Documentation
Parses a non-standard format, consisting of an ISO 8601 combined date and time representation and an IANA time zone ID in brackets, into...
Read more >Formatting Dates and Times | ICU Documentation
Date/Time Format Syntax. A date pattern is a string of characters, where specific strings of characters are replaced with date and time data...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As of Python 3.11,
datetime.fromisoformat
can handle all the important bits of the ISO 8601 spec.I’ll be backporting its code in https://github.com/movermeyer/backports.datetime_fromisoformat/issues/21, so it’ll be available for earlier versions of Python 3.
FWIW,
ciso8601
is still faster than any other parser.Perfect. I’ll test it out soon, thank you!