Does not handle valid time properly
See original GitHub issueValueError: time data '2017-08-29T09:16:45.0631274-05:00' does not match format '%Y-%m-%dT%H:%M:%SZ'
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (10 by maintainers)
Top Results From Across the Web
pset7 finance check50 ':( buy handles valid purchase'
Render an apology, without completing a purchase, if the user cannot afford the number of shares at the current price. You don't need...
Read more >How to check if a HANDLE is valid or not? - c++ - Stack Overflow
Checking to see whether a handle is "valid" is a mistake. You need to have a better way of dealing with this. The...
Read more >If you can't redeem your Apple Gift Card or App Store & iTunes ...
If you see a message that says that your card is not valid, here's what to do: Make sure that your card is...
Read more >Tentative Nonconfirmations (Mismatches) - E-Verify
If the information is incorrect, close the case and select the statement indicating the information was not correct. After the case is closed, ......
Read more ><input type="time"> - HTML: HyperText Markup Language | MDN
A string indicating the latest time to accept, specified in the same time value format as described above. If the specified string isn't...
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
I went through the code and it seems
pysaml2
uses many different libs:time
builtin moduledatetime
builtin modulecalendar
builtin moduledateutil
libpytz
libAdditionally, not all time-related operations are handled through
time_utils.py
.I also went through the XML Schema spec about dateTime datatype and I feel very weird reading that
meaning that the
dateTime
datatype does not represent/support the full ISO 8601 specification, and at the same time there is no clear text about the differences. I cannot understand why someone found it better to semi-specify a new format instead of taking advantage of a specification about the exact thing they wanted to specify in the first place 😞.Regardless, I started looking for libraries with ISO 8601 support. To my surprise, there is not much support for a well-defined standard, but there are lots of libs. I looked at the python modules {
time
,datetime
,calendar
}, and libraries:pytz
,arrow
,moment
,iso8601
,isodatetime
,ciso8601
,numpy/datetime64
,pandas/timeseries
and finallyaniso8601
.I think that
aniso8601
stands out as the most complete implementation that is taking edge cases seriously. Additionally, it is a pure python implementation and works with the standard datetime python type. I think a refactoring should be based on that lib.Coming back to this.
The SAML2 core specification specifies:
This conflicts with the
dateTime
datatype specification as it disallows the timezone component and considers all dates to have been specified as UTC beforehand. ThedateTime
specification defines two timelines - one for timezoneddateTime
s and one for untimezoneddateTime
s. The SAML2 spec essentially dictates that there is only one timeline, always timezoned as UTC.This makes things easier for the implementers, as for example, they need not consider how to compare
dateTime
s from different timelines (a timezoneddateTime
with an untimezoneddatetime
.)As such, the originally posted date
2017-08-29T09:16:45.0631274-05:00
is invalid, as it contains timezone info-05:00
. The correct representation is2017-08-29T14:16:45.063127
(converted to UTC/Z/±00:00 and timezone info removed.)The question now becomes whether implementations actually hold that promise, and if not, how do we handle it…