Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to parse javascript's ISO string format #161

Closed
SIlver-- opened this issue May 6, 2016 · 5 comments
Closed

Not able to parse javascript's ISO string format #161

SIlver-- opened this issue May 6, 2016 · 5 comments
Milestone

Comments

@SIlver--
Copy link

SIlver-- commented May 6, 2016

Using JavaScript's toISOString() does not parse correctly. The method returns a string in simplified extended ISO 8601 format..

Example of the code,

>>> import parsedatetime.parsedatetime as pdt
>>> cal = pdt.Calendar()
>>> cal.parse('2016-05-07T07:52:00.000Z')
((2016, 5, 6, 20, 16, 0, 4, 127, 0), 2)
@idpaterson
Copy link
Collaborator

Thanks for reporting, this problem has already been identified in #15 and time zones are discussed in #97.

@SIlver--
Copy link
Author

Yes but if you do

cal.parse('2016-05-07 07:52:00.000Z')
((2016, 5, 7, 20, 16, 0, 4, 127, 0), 2)

is the result. It's not the timezone that's the issue but the T between the date and time.

@bear
Copy link
Owner

bear commented May 10, 2016

right, we (meaning I) built in only a limited support for ISO 8601 dates so the T and the Z confuse the code. It is something we could probably fix but it would require adding timezone aware code to everything so we haven't yet.

this has always been a case where I suggest that people scan the code for TZ aware ISO 8601 dates before calling PDT

@SIlver--
Copy link
Author

Ah sorry 😓 I see now where you mention it in #97.

@bear
Copy link
Owner

bear commented May 10, 2016

no worries - only those of us who have been dealing with this stuff for years have it all memorized - hell, even I forget most of it now and depend on folks like the amazing @idpaterson to remind me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants