datejs / Datejs

A JavaScript Date and Time Library
Other
1.89k stars 486 forks source link

Issue in parsing ISO string #119

Open zubair1103 opened 6 years ago

zubair1103 commented 6 years ago

ISO string could not be parsed.

Following statement returns null.

Date.parse("2018-04-13T12:26:47.78Z")

MareoRaft commented 6 years ago

Similarly, an ISO string representation of a datetime Python object cannot be parsed:

Date.parse('2018-07-03T14:15:16.002222')

It seems that datejs can't handle the millisecond decimal at the end.

joaoeffting commented 5 years ago

Same here ... any work around for you guys?

MareoRaft commented 5 years ago

Well I might suggest something like

  1. Write a function to detect the presence of milliseconds
  2. splitting it into the pieces '2018-07-03T14:15:16' and '002222'
  3. Using Date.parse on the left piece
  4. Adjusting the Date object by adding the milliseconds to it
  5. Make a PR to this repo which encorporates your fix