Time zone offsets for any time zone, possible change to Date functionality (i18n)
ecmascript at lindenbergsoftware.com
Sun Apr 14 19:49:46 PDT 2013
On Apr 9, 2013, at 15:23 , Nebojša Ćirić wrote:
> I'll add this as a second option to the strawman.
> 2013/4/9 Sorin Mocanu <sorinmocanu at google.com>
> Thank you Nebojša.
> How about if the [timezone] parameter would only be passed at the construction of the Date object? That would (perhaps) allow a user to centralize timezone validation as well.
> For example:
> var date = Date.withTimeZone("America/Los_Angeles", 2013, 3, 9, 15, 11, 0);
> var date = Date.withTimeZone("America/Los_Angeles", 1365545496000);
> date.getHours(); // 15
> date.getUTCHours(); // 22
> Sorin Mocanu, Software Engineer
> Google Switzerland GmbH | Brandschenkestrasse 110 | Zurich, Switzerland | 8002 Zurich
I'm afraid this would be quite confusing. Many people believe already that Date instances are in some local time zone, which they aren't, and this would lead even more astray. Also, I'm not sure what to make of the second example - how is the time zone used in the interpretation of the time value, which should be in UTC? And why does getHours return 15, seven hours behind UTC, when you're in Switzerland?
More information about the es-discuss