deno: 0.2.8
v8: 7.2.502.16
typescript: 3.2.1
Run the following in both node and deno:
new Date().toLocaleString("en-US", {timeZone: "America/Halifax"});
new Date().toLocaleString("en-US", {timeZone: "America/New_York"});
new Date().toLocaleString("en-US", {timeZone: "America/Chicago"});
new Date().toLocaleString("en-US", {timeZone: "America/Denver"});
new Date().toLocaleString("en-US", {timeZone: "America/Los_Angeles"});
new Date().toLocaleString("en-US", {timeZone: "America/Anchorage"});
new Date().toLocaleString("en-US", {timeZone: "Pacific/Honolulu"});
Deno returns incorrect times. It doesn't appear to support the IANA time zones yet.
The Date() object comes directly from V8. Deno currently does nothing with it, but the behaviour is quite a lot different:
Deno
> new Date().toLocaleString("en-US", {timeZone: "Pacific/Honolulu"});
Fri Feb 01 2019 16:09:28 GMT+1000 (AEST)
Node.js v8.11.4
> new Date().toLocaleString("en-US", {timeZone: "Pacific/Honolulu"});
'1/31/2019, 8:09:11 PM'
Chrome 71.0.3578.98
> new Date().toLocaleString("en-US", {timeZone: "Pacific/Honolulu"});
"1/31/2019, 8:04:45 PM"
Exactly. The "en-US" argument has no effect on the date/time format, and the specified IANA timezone argument is ignored too.
Maybe V8 depends on its host (slightly) to facilitate this functionality and that slight thing isn't "wired up" yet in deno? Not sure.....
Perhaps the spec might reveal something:
http://www.ecma-international.org/ecma-402/5.0/index.html#sup-date.prototype.tolocalestring
Side note: I just submitted a bug to Chromium that reports two official time zones that it doesn't currently support.
It looks like ICU needs to be included in the build:
https://github.com/phpv8/v8js/issues/306
https://nodejs.org/api/intl.html#intl_embed_the_entire_icu_full_icu
@kishiguro made some progress on compiling deno with ICU embedded. It added 14MB to the final Deno executable. His instructions are here:
https://github.com/denoland/deno/issues/1968#issuecomment-633204393
duplicate of https://github.com/denoland/deno/issues/1968
Most helpful comment
It looks like ICU needs to be included in the build:
https://github.com/phpv8/v8js/issues/306
https://nodejs.org/api/intl.html#intl_embed_the_entire_icu_full_icu