1
0
Fork 0
mirror of synced 2024-09-29 16:51:33 +13:00

Updating test.

This commit is contained in:
mike12345567 2021-06-09 12:11:40 +01:00
parent 310ed3aefc
commit f9ba157f97

View file

@ -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")