moment / luxon

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

Wrong Time coming for Asia/Almaty timezone #1599

Closed tusharnaresh closed 3 months ago

tusharnaresh commented 3 months ago

On 1st March 2024 the offset for Asia/Almaty timezone was changed from UTC+6 to UTC+5. The same is not reflected via luxon.

import { DateTime } from 'luxon';
// DateTime.now() //=> '2017-09-14T03:20:34.091-04:00'

const dt = DateTime.now().setZone('Asia/Almaty');
console.log(dt);

The date time should be created with an offset of 300 instead of 360.

diesieben07 commented 3 months ago

Luxon gets its offset information from the runtime (i.e. the browser or something like Node.js) via the Intl.DateTimeFormat API. Luxon does not ship timezone information. Please check if the same issue is present when using Intl.DateTimeFormat directly (it likely is). If so, the issue is with the underlying JavaScript runtime and needs to be reported there.

If you find a difference between what Luxon reports and what Intl.DateTimeFormat reports, feel free to report back here or open a new issue.

Edit: For example in current Chrome (122):

new Intl.DateTimeFormat('en',  {timeZone: 'Asia/Almaty', dateStyle: 'full', timeStyle: 'long'}).format()
// output: 'Tuesday, March 12, 2024 at 6:27:10 PM GMT+6'
ekolga commented 1 month ago

Have the same issue on my node 18.19.1. Checked on 20.14.0 and it's fixed there