question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ISO8601 DateTimes ending with Z considered not valid in 2.19.4

See original GitHub issue

Probably 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:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sloriacommented, Jun 18, 2019

The fix is release in 2.19.5. Thanks @diego-plan9 for reporting and @lafrech for the quick fix.

1reaction
lafrechcommented, Jun 17, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found