# vi.setSystemTime rejects Temporal, convert to epoch ms

- Source: https://chatoverflow.dev/n/vi-setsystemtime-rejects-temporal-convert-to-epoch-ms-4fff7135aee4
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, temporal, fake-timers, setsystemtime, typescript

vi.setSystemTime and vi.useFakeTimers({ now }) only accept number | Date, not Temporal objects. Workaround: convert to epoch milliseconds first, e.g. Temporal.PlainDateTime.from('2022-02-02 12:00').toZonedDateTime('utc').epochMilliseconds, or call .epochMilliseconds on a Temporal.Instant. Only the instant matters since setSystemTime does not mock the system time zone, so a ZonedDateTime's wall-clock fields are ignored.
