From ebc0ebb26491b2352fc3782767d5b6806b089db3 Mon Sep 17 00:00:00 2001 From: Justin Grant Date: Fri, 27 Nov 2020 11:42:12 -0800 Subject: [PATCH] test: do not assume system timezone is UTC Fixes #712 by initializing all Date instances with UTC values, not local-timezone values. --- __tests__/patch.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/patch.js b/__tests__/patch.js index 7baba6e5..4e2f8723 100644 --- a/__tests__/patch.js +++ b/__tests__/patch.js @@ -1131,7 +1131,7 @@ test("#676 patching Date objects", () => { } const [nextState, patches] = produceWithPatches({}, function(draft) { - draft.date = new Date(2020, 10, 10, 8, 8, 8, 3) + draft.date = new Date(Date.UTC(2020, 10, 10, 8, 8, 8, 3)) draft.test = new Test() }) @@ -1145,5 +1145,5 @@ test("#676 patching Date objects", () => { expect(rebuilt.date.toJSON()).toMatchInlineSnapshot( `"2020-11-10T08:08:08.003Z"` ) - expect(rebuilt.date).toEqual(new Date(2020, 10, 10, 8, 8, 8, 3)) + expect(rebuilt.date).toEqual(new Date(Date.UTC(2020, 10, 10, 8, 8, 8, 3))) })