fix(site): Use relative date in Timeline test (#5377)

This commit is contained in:
Mathias Fredriksson
2022-12-12 13:15:28 +02:00
committed by GitHub
parent ca0374b94f
commit 1907f13c5f
@@ -2,7 +2,13 @@ import { createDisplayDate } from "./TimelineDateRow"
describe("createDisplayDate", () => {
it("returns correctly for Saturdays", () => {
const date = new Date("Sat Dec 03 2022 00:00:00 GMT-0500")
const now = new Date()
const date = new Date(
now.getFullYear(),
now.getMonth(),
// Previous Saturday, from now.
now.getDate() - now.getDay() - 1,
)
expect(createDisplayDate(date)).toEqual("last Saturday")
})
})