DateTime.now() incorrectly parsing the timezone offset.
Author: razorblade446Created Sep 9, 2025Updated Mar 25, 2026
Labelsissue: troubleshooting
Describe the bug When using DateTime.now(), result is being offset twice from the system date applied.
To Reproduce Used Jest to reproduce issue.
- Mock Sytem Time:
beforeEach(() => {
jest.useFakeTimers();
jest.setSystemTime(new Date("2024-01-15T10:00:00-05:00"));
});- Create a test:
it('should return date according to the store timezone', () => {
const result = DateTime.now();
expect(result.toISO()).toBe('2024-01-15T10:00:00.000-05:00');
});Actual vs Expected behavior
Actual: '2024-01-15T05:00:00.000-05:00' Expected: '2024-01-15T10:00:00.000-05:00'
It's an issue, as DateTime.utc() correctly calculates UTC time.
Desktop (please complete the following information):
- OS: MacOS Sequoia 15.6.1
- Browser Chrome 139.0.7258.157 (Official Build) (arm64)
- Luxon version 3.7.1
- Your timezone America/Bogota
Source: moment/luxon