Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(site): Use relative date in Timeline test
  • Loading branch information
mafredri committed Dec 12, 2022
commit d0f1b85f4fa549e9a2b14545ab4d2713944d6a0a
8 changes: 7 additions & 1 deletion site/src/components/Timeline/Timeline.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
})