Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript date function returns "Date {Invalid Date}" in Firefox browser

Facing a problem with JavaScript Date function, returns "Date {Invalid Date}" in Firefox browser but works fine in Google chrome.

// My Input is
new Date("Sat Jan 01 00:00:00 EST 1");

// Works fine in google chrome 
// Result: Mon Jan 01 2001 10:30:00 GMT+0530 (India Standard Time)

// Not working in Firefox (Version: 15.0.1)
// Result: Date {Invalid Date}
like image 209
Krishna Kumar Avatar asked Feb 18 '23 21:02

Krishna Kumar


1 Answers

This works in all browsers -

new Date('2001/01/31 12:00:00 AM')

like image 122
Tahin Rahman Avatar answered Feb 22 '23 07:02

Tahin Rahman