goja icon indicating copy to clipboard operation
goja copied to clipboard

new Date().toString() returns shortened timezone

Open zedd3v opened this issue 2 years ago • 2 comments

new Date().toString()

returns: Thu Jan 05 2023 00:16:15 GMT+0100 (CET) expected Thu Jan 05 2023 00:16:15 GMT+0100 (Central European Standard Time)

zedd3v avatar Jan 04 '23 23:01 zedd3v

The specification leaves the time zone implementation-defined (see https://tc39.es/ecma262/#sec-timezoneestring).

Having said that I wouldn't mind bringing it in line with v8 and Spider Monkey if it was an easy fix. Unfortunately it doesn't look this way: the full localized time zone name is not available from the standard Go library and I could not find any 3rd party library either. If I missed something I'd welcome a PR.

dop251 avatar Jan 05 '23 11:01 dop251

I found that V8 uses https://github.com/unicode-org/icu

https://github.com/unicode-org/icu/blob/main/icu4c/source/data/zone/en.txt

It doesn't look like an easy fix but it would be possible to reuse some of their logic

zedd3v avatar Jan 05 '23 17:01 zedd3v