new Date("May 27, 2011, 1:00 pm EEST")
Firebug Response:
Date {Invalid Date}
Is this a known javascript bug ? how do you interpret the "Eastern European Summer Time" timezone in javascript with date ?
I can change the timezone to +03:00 or +0300 for example, but then it wouldn't be as friendly for the user, because im using the < abbr > tag and with jQuery i format each abbr innerHTML to what their title value is, so that when you hover over it, I still want the tooltip to display "May 27, 2011, 1:00 pm EEST", but in innerHTML i only need "May 27, 2011"
<abbr class="timestamp blue" title="May 27, 2011, 1:00 pm EEST">May 27, 2011</abbr>
However, because of EEST, i get this
<abbr class="timestamp blue" title="May 27, 2011, 1:00 pm EEST">NaN</abbr>
开发者_StackOverflow中文版
If i change EEST to something more common such as EST or GMT, then no problem, weird.
From the ECMA-script specification (15.9.1.15 Date Time String Format):
There exists no international standard that specifies abbreviations for civil time zones like CET, EST, etc. and sometimes the same abbreviation is even used for two very different time zones. For this reason, ISO 8601 and this format specifies numeric representations of date and time.
From ISO 8601
There are no time zone designators in ISO 8601. Time is only represented as local time or in relation to UTC
In short: it's not a bug. You can't use zones like EEST and the like in the javascript Date object. You'll have to stick to 'UTC' or the +/- notation.
You can find a lot of information on the subject @this webpage
精彩评论