Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IANA TimeZone Support #1636

Closed
Lonniebiz opened this issue Feb 1, 2019 · 5 comments
Closed

IANA TimeZone Support #1636

Lonniebiz opened this issue Feb 1, 2019 · 5 comments

Comments

@Lonniebiz
Copy link

Lonniebiz commented Feb 1, 2019

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.

@kitsonk
Copy link
Contributor

kitsonk commented Feb 1, 2019

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"

@Lonniebiz
Copy link
Author

Lonniebiz commented Feb 1, 2019

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.

@hayd
Copy link
Contributor

hayd commented Feb 2, 2019

It looks like ICU needs to be included in the build:

phpv8/v8js#306
https://nodejs.org/api/intl.html#intl_embed_the_entire_icu_full_icu

@Lonniebiz
Copy link
Author

Lonniebiz commented May 24, 2020

@kishiguro made some progress on compiling deno with ICU embedded. It added 14MB to the final Deno executable. His instructions are here:
#1968 (comment)

@ry
Copy link
Member

ry commented Jun 15, 2020

duplicate of #1968

@ry ry closed this as completed Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants