Ash*_*ani 3 javascript google-chrome date cross-browser
在chrome中我试图检查日期是否是有效日期.
有一个变量:
var d = new Date('9/'); // Not a correct format
Run Code Online (Sandbox Code Playgroud)
在Chrome中
console.log(new Date('9/')); // Output: Sat Sep 01 2001 00:00:00 GMT+0530 (India Standard Time) Which is wrong as I am providing wrong date.
Run Code Online (Sandbox Code Playgroud)
在Firefox中
console.log(new Date('9/')); // Output: Invalid Date
Run Code Online (Sandbox Code Playgroud)
还使用firefox中的date.toLocaleString()输出06 May 2007 00:00:00
在铬中它是1/9/2001;
所以我的问题是如何在chrome中验证日期并保持代码不受这些差异的影响.如果需要更多细节请写评论.