Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

DateTimeFormat error for Chilean Time #25834

Closed
tomascharad opened this issue Aug 10, 2015 · 10 comments
Closed

DateTimeFormat error for Chilean Time #25834

tomascharad opened this issue Aug 10, 2015 · 10 comments

Comments

@tomascharad
Copy link

(node v.0.12.7)
On chrome's V8 the output of the following code:
date = new Date('Mon Jun 15 2015 21:43:11 GMT-0300 (CLT)')
formatter = Intl.DateTimeFormat('En-us', { hour: 'numeric', hour12: false })
formatter.format(date)
Is "21".

However if I do the same on a node console I obtain '20'.

In Chile we've faced a change of our "Winter time" and this might be causing this issue.

Maybe there is something needed to be updated in the Intl module?

@tomascharad tomascharad changed the title DateTimeFormat error for Chile DateTimeFormat error for Chilean Time Aug 10, 2015
@dnakamura
Copy link

I believe its a discrepency in the timezone parsing. From chrome js console

date = new Date('Mon Jun 15 2015 21:43:11 GMT-0300 (CLT)')
Mon Jun 15 2015 20:43:11 GMT-0400 (Eastern Daylight Time)

It seems to be picking up the 'CLT' (which is actually GMT-0400).
From node:

 > date = new Date('Mon Jun 15 2015 21:43:11 GMT-0300 (CLT)')
Mon Jun 15 2015 20:43:11 GMT-0400 (Eastern Daylight Time)

seems to be using the 'GMT-0300' string rather than recognizing 'CLT'

@tomascharad
Copy link
Author

@dnakamura maybe you meant (GMT -0300) on your second code block, right?

Anyway, I don't seem to get the (Eastern Daylight Time) on chrome, I get the same output than the one I'm writing below, which might be caused by you being in a different time zone than mine.

Mon Jun 15 2015 21:43:11 GMT-0300 (CLT)

@dnakamura
Copy link

@tomascharad Ah apparently I got confused. chrome and node seem to be in agreement parsing "Mon Jun 15 2015 21:43:11 GMT-0300 (CLT)" into "Mon Jun 15 2015 20:43:11 GMT-0400 (Eastern Daylight Time)" . Are you running chrome and node on the same machine?
Also apparently I'm wrong. They changed CLT to be GMT-0300 (I didn't think you could do that).

@tomascharad
Copy link
Author

Look, here is the full log of the actions on chrome:

date = new Date('Mon Jun 15 2015 21:43:11 GMT-0300 (CLT)')
Mon Jun 15 2015 21:43:11 GMT-0300 (CLT)
formatter = Intl.DateTimeFormat('En-us', { hour: 'numeric', hour12: false })
Object {resolved: Object}
formatter.format(date)
"21"

And on Node:

date = new Date('Mon Jun 15 2015 21:43:11 GMT-0300 (CLT)')
Mon Jun 15 2015 21:43:11 GMT-0300 (CLT)
formatter = Intl.DateTimeFormat('En-us', { hour: 'numeric', hour12: false })
{}
formatter.format(date)
'20'

@tomascharad
Copy link
Author

Also, just for having more background, if I do on Chrome:

new Date()
Thu Aug 13 2015 09:21:45 GMT-0300 (CLT)

and then on Node:

new Date()
Thu Aug 13 2015 09:22:55 GMT-0300 (CLT)

@srl295
Copy link
Member

srl295 commented Aug 13, 2015

May be fixed by #25855 if the timezone data was in ICU 55

@srl295
Copy link
Member

srl295 commented Aug 13, 2015

@tomascharad can you try the upgrade procedure in https://github.com/joyent/node/wiki/Intl#updating-timezone-data ?

@tomascharad
Copy link
Author

@srl295 Could you please let me know where should I change ICU_TIMEZONE_FILES_DIR?

@srl295
Copy link
Member

srl295 commented Aug 23, 2015

Set it in the environment. With set or setenv before node starts.

El sábado, 22 de agosto de 2015, Tomás Charad notifications@github.com
escribió:

@srl295 https://github.com/srl295 Could you please let me know where
should I change ICU_TIMEZONE_FILES_DIR?


Reply to this email directly or view it on GitHub
#25834 (comment).

@srl295
Copy link
Member

srl295 commented Sep 2, 2015

@tomascharad sorry for the slow confirmation. It is due to the tz version. In the latest released node which has ICU 55 it seems to be working:

$ env TZ=America/Santiago node
> process.version
'v3.3.0'
> process.config.variables.icu_ver_major
'55'
> date = new Date('Mon Jun 15 2015 21:43:11 GMT-0300 (CLT)')
Mon Jun 15 2015 21:43:11 GMT-0300 (CLT)
> formatter = Intl.DateTimeFormat('En-us', { hour: 'numeric', hour12: false })
{}
> formatter.format(date)
'21'

Above I discuss how to update the tz data. If it's not working, please reopen nodejs/node#2372 or a new issue. Thanks!

@srl295 srl295 closed this as completed Sep 2, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants