本文介绍了JavaScript日期函数返回“Date {Invalid Date}”在Firefox浏览器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
面对 JavaScript日期
函数的问题,在Firefox浏览器中返回Date {Invalid Date}
,但工作
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}
推荐答案
不以这种方式使用时区参数。我的想法是,Chrome只是忽略它。日期(年,月,日,时,分,秒,毫秒)
Date does not take a timezone parameter in that way. My thought is that Chrome is just ignoring it.
new Date(year, month, day [, hour, minute, second, millisecond])
请参阅@ Brett的评论以获取更多信息。
Please see @Brett's comment below for more information.
这篇关于JavaScript日期函数返回“Date {Invalid Date}”在Firefox浏览器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!