moment / luxon

⏱ A library for working with dates and times in JS
https://moment.github.io/luxon
MIT License
15.26k stars 731 forks source link

Asia/Singapore timezone offsetNameShort is wrong #1422

Closed puddinator closed 1 year ago

puddinator commented 1 year ago

Hi all, thanks for this great library.

For Asia/Singapore time zone, offsetNameLong returns Singapore which is correct, but offsetNameShort remains GMT which is wrong. I get the same results from toResult('ZZZZZ') and toResult('ZZZZ') respectively.

I've read that Luxon gets the offsetName from Intl. Intl returns the correct output

new Intl.DateTimeFormat('en', {
            timeZoneName: 'short',
            timeZone: 'Asia/Singapore',
        }).format()

is GMT+8

diesieben07 commented 1 year ago

Cannot reproduce:

console.log(new Intl.DateTimeFormat('en', {timeZoneName: 'short', timeZone: 'Asia/Singapore',}).format());
console.log(DateTime.now().setZone('Asia/Singapore').toFormat('ZZZZZ'));
console.log(DateTime.now().setZone('Asia/Singapore').toFormat('ZZZZ'));

Outputs:

4/18/2023, GMT+8
Singapore Standard Time
GMT+8

I'm using Node 18.12 to test. What runtime are you using?

puddinator commented 1 year ago

Wow, you're spot on with the issue with version. My bad, I was using an older version of Luxon!