P
P
picka2021-03-17 23:13:18
JavaScript
picka, 2021-03-17 23:13:18

Why does this JS script not work in Safari?

Here is the actual script and example: Example
In Chrome it works fine, in Safari it returns NaN

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2021-03-18
@picka

Because in Date.parse you are feeding garbage
chrome -> Date.parse('2021-07-06 08:15:00') -> 1625548500000
safari -> Date.parse('2021-07-06 08:15:00' ) -> null
would be correct
Date.parse('2021-07-06T08:15:00.0Z')
only with a more careful time zone

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question