Skip to content

Commit 1907f13

Browse files
authored
fix(site): Use relative date in Timeline test (#5377)
1 parent ca0374b commit 1907f13

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

site/src/components/Timeline/Timeline.test.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import { createDisplayDate } from "./TimelineDateRow"
22

33
describe("createDisplayDate", () => {
44
it("returns correctly for Saturdays", () => {
5-
const date = new Date("Sat Dec 03 2022 00:00:00 GMT-0500")
5+
const now = new Date()
6+
const date = new Date(
7+
now.getFullYear(),
8+
now.getMonth(),
9+
// Previous Saturday, from now.
10+
now.getDate() - now.getDay() - 1,
11+
)
612
expect(createDisplayDate(date)).toEqual("last Saturday")
713
})
814
})

0 commit comments

Comments
 (0)