You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
For years 1935 and before, luxon's DateTime.fromJSDate acts incorrectly on Chrome browser while it works correctly on Firefox.
To Reproduce DateTime.fromJSDate(new Date('1935-01-01 00:00:00')).toFormat('yyyy-MM-dd HH:mm:ss');
// On Chrome it wrongly return 1934-12-31 23:59:16
// On Firefox it correctly return 1935-01-01 00:00:00
Important note is that the following return the same milliseconds on both browsers: DateTime.fromJSDate(new Date('1935-01-01 00:00:00')).valueOf();
// On both Chrome and Firefox return -1104549944000
More examples in the attached screenshots:
Actual vs Expected behavior
DateTime.fromJSDate should work correctly and consistently across browsers for historical dates, so that on Chrome it parses the passed JS Date with the expected precision and doesn't jump back.
Desktop (please complete the following information):
OS: Ubuntu 22.04.4 LTS
Browser Chrome 126.0.6478.61, Firefox 128
Luxon version: 3.4.4
Your timezone: Asia/Tehran
Additional context
The text was updated successfully, but these errors were encountered:
Unfortunately this is just down to a problem with fractional timezone offsets and how browsers handle them differently.
The following behaves differently in Chrome and Firefox (assuming timezone Asia/Tehran):
Describe the bug
For years 1935 and before, luxon's
DateTime.fromJSDate
acts incorrectly on Chrome browser while it works correctly on Firefox.To Reproduce
DateTime.fromJSDate(new Date('1935-01-01 00:00:00')).toFormat('yyyy-MM-dd HH:mm:ss');
// On Chrome it wrongly return
1934-12-31 23:59:16
// On Firefox it correctly return
1935-01-01 00:00:00
Important note is that the following return the same milliseconds on both browsers:
DateTime.fromJSDate(new Date('1935-01-01 00:00:00')).valueOf();
// On both Chrome and Firefox return
-1104549944000
More examples in the attached screenshots:
Actual vs Expected behavior
DateTime.fromJSDate should work correctly and consistently across browsers for historical dates, so that on Chrome it parses the passed JS Date with the expected precision and doesn't jump back.
Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: