When I parse 1909-01-01T03:00:00Z
with Luxon using DateTime.fromISO
on a PC with the -3 GMT timezone instead of getting the January 1st 1909 at midnight I get December 31st 1908 22:43. I am doing something wrong or is this a bug?
Asked
Active
Viewed 1,180 times
1

Alejandro
- 351
- 4
- 11
-
2See [*Browsers, time zones, Chrome 67 Error (historic timezone changes)*](https://stackoverflow.com/questions/50609860/browsers-time-zones-chrome-67-error-historic-timezone-changes). What location are you using for the offset? You can check historic offsets for various locations at [*timeanddate.com*](https://www.timeanddate.com). – RobG Apr 21 '21 at 21:38
1 Answers
0
Reading the Luxon docs I managed to find a solution. Parsing the string as UTC then converting it to local with keepLocalTime
kept the correct date.
let date = DateTime.fromISO(dateString, { zone: 'utc' });
date = fecha.setZone('local', { keepLocalTime: true });

Alejandro
- 351
- 4
- 11