MCPcopy
hub / github.com/date-fns/date-fns / fakeDate

Function fakeDate

pkgs/core/src/_lib/test/index.ts:41–55  ·  view source on GitHub ↗
(date: number | Date)

Source from the content-addressed store, hash-verified

39}
40
41export function fakeDate(date: number | Date) {
42 function fakeNow(date: number | Date) {
43 vi.setSystemTime(date);
44 }
45
46 beforeEach(() => {
47 vi.useFakeTimers({ now: date });
48 });
49
50 afterEach(() => {
51 vi.useRealTimers();
52 });
53
54 return { fakeNow };
55}

Callers 15

test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected