From 92d878254f4916356bf428d4c1393fe4054cb703 Mon Sep 17 00:00:00 2001 From: Nam PHAM <13-npham@users.noreply.gitlab.maiia.io> Date: Thu, 9 Dec 2021 15:22:27 +0100 Subject: [PATCH] test: Check if valueOf() is correct across DST --- test/plugin/timezone.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/plugin/timezone.test.js b/test/plugin/timezone.test.js index dfcebf47e..2b28cc309 100644 --- a/test/plugin/timezone.test.js +++ b/test/plugin/timezone.test.js @@ -21,6 +21,7 @@ const NY = 'America/New_York' const VAN = 'America/Vancouver' const DEN = 'America/Denver' const TOKYO = 'Asia/Tokyo' +const PARIS = 'Europe/Paris' describe('Guess', () => { it('return string', () => { @@ -212,6 +213,18 @@ describe('DST, a time that never existed Fall Back', () => { }) }) +it('DST valueOf', () => { + const day1 = '2021-11-17T09:45:00.000Z' + const d1 = dayjs.utc(day1).tz(PARIS) + const m1 = moment.tz(day1, PARIS) + expect(d1.valueOf()).toBe(m1.valueOf()) + + const day2 = '2021-05-17T09:45:00.000Z' + const d2 = dayjs.utc(day2).tz(PARIS) + const m2 = moment.tz(day2, PARIS) + expect(d2.valueOf()).toBe(m2.valueOf()) +}) + describe('set Default', () => { it('default timezone', () => { const dateStr = '2014-06-01 12:00'