Why does Luxon DateTime.offset return the opposite value of native Javascript Date.getTimezoneOffset?

Viewed 28

Is there a specific reason why the Luxon DateTime offset is the opposite of the native JavaScript Date getTimezoneOffset?

import { DateTime } from 'luxon';

const luxonOffset = DateTime.now().offset; // -600
const jsDateOffset = new Date().getTimezoneOffset(); // 600

I made a small example here: https://stackblitz.com/edit/typescript-w4vz2u?file=index.ts

enter image description here

The screenshot above is from Hawaii timezone... enter image description here

I believe that this is the code from Luxon which inverts the offset: https://github.com/moment/luxon/blob/master/src/zones/systemZone.js#L48-L50

0 Answers
Related