0

Can somone please explain how Javascript parses dates. I receives a date from an external api '1899-12-30T07:00:00+01:00' when I create a new Date 14 seconds seems to be added, new Date( '1899-12-30T07:00:00+01:00').toString() prints 'Sat Dec 30 1899 07:00:14 GMT+0100 (Central European Standard Time)' .

Another interesting date is new Date("1878-12-31T07:00:00+01:00").toTimeString() that prints "07:12:12 GMT+0112 (Central European Standard Time)".

Eric
  • 11
  • I can't reproduce this error. What is your use case? Can you post the full code of this method call? When I put `new Date( '1899-12-30T07:00:00+01:00').toString()` it returns `"Sat Dec 30 1899 01:00:00 GMT-0500 (Eastern Standard Time)"` – Jordan Lagan Jun 23 '20 at 12:40
  • No time for an answer nor for finding a dupe (I'm pretty sure there is one), but it's because you're in Sweden, and that between 1879 and 1899 the swedish time standard SET had an offset of 1:00:14 ([according to IANA](https://www.iana.org/time-zones)) – Kaiido Jun 23 '20 at 12:53
  • @Kaiido Believe me, I´ve been googling for an hour without luck, but thanks for pointing me in the right direction. – Eric Jun 23 '20 at 13:06
  • @pppery—thanks. There a badges? :-0 – RobG Jun 24 '20 at 02:31

0 Answers0