operatorfabric-core icon indicating copy to clipboard operation
operatorfabric-core copied to clipboard

Replace deprecated library Moment.js

Open quinarygio opened this issue 2 years ago • 0 comments

Firt tentative was to replace it with dayjs library (https://day.js.org/). Found an issue with timezone and day ligth saving, it seems to occur only when setting "Europe/London" timezone and with a date in a "no day light saving" period. The following test is failing:

const startDate = Date.parse('10 Mar 2023 10:00:00 GMT');

const timezone = 'Europe/London';

let dayDateTime = dayjs(startDate);
dayDateTime = dayDateTime.tz(timezone)
        .set('hour', 10)
        .set('minute', 15);
const ddate = dayDateTime.valueOf();

let momentDateTime = moment(startDate);
momentDateTime.tz(timezone);
momentDateTime.set('hours',10);
momentDateTime.set('minutes',15);
const mdate = momentDateTime.valueOf();

expect(mdate).toEqual(ddate);_

quinarygio avatar Jun 19 '23 13:06 quinarygio