考虑以下示例
new Date("Wed, 28 May 2014 09:50:06 EEST"); // Invalid Date
new Date("Thu, 26 Jun 2014 09:09:27 EDT"); // OK, is parsed
new Date("Wed, 28 May 2014 09:50:06 (EEST)"); // OK, is parsed
new Date("Thu, 26 Jun 2014 09:09:27 (EDT)"); // OK, is parsed
为什么" EEST"不解析没有括号的示例,而第二个示例是?
答案 0 :(得分:1)
EEST
不是的有效时区。无论内容如何,都会忽略带括号的版本。
例如(我在东部地区):
// Eastern, by default
new Date("Thu, 26 Jun 2014 09:09:27");
Thu Jun 26 2014 09:09:27 GMT-0400 (Eastern Daylight Time)
// Eastern, explicitly
new Date("Thu, 26 Jun 2014 09:09:27 EDT");
Thu Jun 26 2014 09:09:27 GMT-0400 (Eastern Daylight Time)
// Central, explicitly
new Date("Thu, 26 Jun 2014 09:09:27 CDT");
Thu Jun 26 2014 10:09:27 GMT-0400 (Eastern Daylight Time)
// Ignored, so eastern
new Date("Thu, 26 Jun 2014 09:09:27 (CDT)");
Thu Jun 26 2014 09:09:27 GMT-0400 (Eastern Daylight Time)
new Date("Thu, 26 Jun 2014 09:09:27 (EEST)");
Thu Jun 26 2014 09:09:27 GMT-0400 (Eastern Daylight Time)