Recently I was working on a website where I needed to add a countdown timer. Rather than going with a bloated library I chose to implement it myself.
Everything worked great until I checked it on Safari. I got a NaN for all the date data. After doing a few google searches I found it was a common issue. Luckily I found a very simple solution here; use an ISO 8601 date format.
Basically the issue was that I was missing a semicolon in the timezone.
This did not work: 2020-06-22T00:00:00.000-0800
But this did work: 2020-06-22T00:00:00.000-08:00
The format breaks down to this (date)T(time)+/-(timezone offset)
Date is year-month-day followed by T for time, then the time as hour:minute:seconds:milliseconds
Leave a Reply
You must be logged in to post a comment.