Next.js — Date bug in Firefox
Published in
Sep 30, 2022
I came across this interesting bug yesterday in Firefox. The notification feature worked in Chrome but not in Firefox in production and I did my investigation in local.
I did the experiment in the development tool for both browser
Chrome
new Date("2022-09-29 15:00:00.000-7")
Thu Sep 29 2022 18:00:00 GMT-0400 (Eastern Daylight Time)new Date("2022-09-29 15:00:00.000-07")
Thu Sep 29 2022 18:00:00 GMT-0400 (Eastern Daylight Time)
FireFox
new Date("2022-09-29 15:00:00.000-7")
Invalid Datenew Date("2022-09-29 15:00:00.000-07") Thu Sep 29 2022 18:00:00 GMT-0400 (Eastern Daylight Time)
Takeaway
The reason is because I set the time to 2022-09-29 15:00:00.000-7
so I should set the time to 2022-09-29 15:00:00.000-07
instead. We should user -/+
with 2 digit all the time.