Weird bug locale dates 1900 and before
See original GitHub issueAm I missing something? Dates are wrong for 1900 and before:
https://codesandbox.io/s/ww5859zjwk
Very important: this is happening when I set my windows timezone to UTC +01 Madrid
. If I set it to UTC +00 London
the same bug occurs for 1922 and before. This is only happening in Chrome.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to Fix Excel Dates That Won't Change Format - Contextures
How to fix Excel dates that will not change format. Fix dates that end up in the wrong order when sorted. Use built-in...
Read more >Year 1900 problem - Wikipedia
The year 1900 problem concerns the misinterpretation of years recorded by only their last two digits, and whether they occurred before or after...
Read more >Demystifying DateTime Manipulation in JavaScript - Toptal
Time and date manipulation is notoriously difficult. Developers encountering time zone rules, leap seconds, differences in locale-specific formatting are ...
Read more >Why is subtracting these two times (in 1927) giving a strange ...
The real answer is to always, always use seconds since an epoch for logging, like the Unix epoch, with 64 bit integer representation...
Read more >6 Ways to Fix Dates Formatted as Text in Excel
You can quickly fix all dates using the error checking by selecting all of your cells containing date text strings before clicking on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is the weirdest bug yet! I figured it out and unfortunately I don’t have a solution. Here’s the problem: In Madrid, in 1900, the offset from UTC was 14 minutes and 44 seconds. It’s crazy but true. You can go here and pull down the dropdown to 1900 and see it.
Unfortunately, the JS Date methods will only give TZ offsets in minutes:
which is of course wrong by 44 seconds. Luxon has some complicated logic built for handling a host of browser DST bugs and for implementing non-local time zones. That logic depends on
getTimeZoneOffset
. The result is that Luxon is off by 44 seconds on the time, resulting in:The bug only happens in Chrome because it’s the only browser with good enough historical data to have this problem. I’m not sure what to do here:
getTimezoneOffsetMilliseconds()
but they don’tSo barring a time machine to go back and change Spain’s historic offsets, I’m not sure how to fix this.
I wasn’t able to reproduce any issues with London.
I’m going to close this. While I agree this is a bug, it’s not one that Luxon can fix, so it’s just taking up space in the issue list.