From e67f19ea20ed5ec60918375ccc1eb5cac77bf94c Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 9 Jun 2021 12:11:40 +0100 Subject: [PATCH] Updating test. --- packages/string-templates/test/helpers.spec.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/string-templates/test/helpers.spec.js b/packages/string-templates/test/helpers.spec.js index f0a71b9ba..d46070879 100644 --- a/packages/string-templates/test/helpers.spec.js +++ b/packages/string-templates/test/helpers.spec.js @@ -163,7 +163,7 @@ describe("test the date helpers", () => { it("should allow use of the date helper", async () => { const date = new Date(1611577535000) const output = await processString("{{ date time 'YYYY-MM-DD' }}", { - time: date.toISOString(), + time: date.toUTCString(), }) expect(output).toBe("2021-01-25") }) @@ -177,15 +177,16 @@ describe("test the date helpers", () => { it("should test the timezone capabilities", async () => { const date = new Date(1611577535000) const output = await processString("{{ date time 'HH-mm-ss Z' 'America/New_York' }}", { - time: date.toISOString(), + time: date.toUTCString(), }) - expect(output).toBe("07-25-35 -04:00") + const formatted = new dayjs(date).tz("America/New_York").format("HH-mm-ss Z") + expect(output).toBe(formatted) }) it("should guess the users timezone when not specified", async () => { const date = new Date() const output = await processString("{{ date time 'Z' }}", { - time: date.toISOString() + time: date.toUTCString() }) const timezone = dayjs.tz.guess() const offset = new dayjs(date).tz(timezone).format("Z")