ISO8601 DateTimes ending with Z considered not valid in 2.19.4
See original GitHub issueProbably related to #1247 and #1234 - in marshmallow 2.19.4
, with python-dateutil
not installed, it seems that loading a datetime in ISO8601 that ends in Z
(UTC time) results in an error:
class Foo(Schema):
date = DateTime(required=True)
foo_schema = Foo(strict=True)
a_date_with_z = '2019-06-17T00:57:41.000Z'
foo_schema.load({'date': a_date_with_z})
marshmallow.exceptions.ValidationError: {'date': ['Not a valid datetime.']}
Digging a bit deeper, it seems from_iso_datetime
is failing with a unconverted data remains: Z
- my understanding of the spec is rather limited, but it seems that they are indeed valid ISO8601 dates (and in marshmallow==2.19.3
and earlier, the previous snippet seems to work without raising validation errors).
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
ISO 8601 date-time format combining 'Z' and offset of '+0000'
No, not OK. No, the Z is an offset-from-UTC so it should not be combined redundantly with a numerical offset of +00:00 or...
Read more >ISO 8601-1:2019(en), Date and time
This document specifies representations of dates of the Gregorian calendar and times based on the 24-hour clock, as well as composite elements of...
Read more >ISO 8601 - Wikipedia
ISO 8601 is an international standard covering the worldwide exchange and communication of date and time-related data. It is maintained by the Geneva-based ......
Read more >Date and Time Formats - W3C
This profile defines a restricted range of formats, all of which are valid ISO 8601 dates and times. The aim is to simplify...
Read more >FixedDateFormat.FixedFormat (Apache Log4j Core 2.19.0 API)
ISO8601 time format with support for microsecond precision: "yyyy-MM-dd'T'HH:mm:ss.nnnnnn" . US_MONTH_DAY_YEAR2_TIME. public static final FixedDateFormat.
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 FreeTop 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
Top GitHub Comments
The fix is release in 2.19.5. Thanks @diego-plan9 for reporting and @lafrech for the quick fix.
I just submitted a PR: https://github.com/marshmallow-code/marshmallow/pull/1252.
It might not be the most elegant/pythonic/efficient but I think it does what it says.