Overview
Access the clock through the browser context:Methods
install
Installs fake timers and controls time.number | string | Date
Time to initialize the clock. Can be:
number: Unix timestamp in millisecondsstring: Date stringDate: Date object
Promise<void>
fastForward
Advances the clock by the specified amount of time.number | string
required
Amount of time to advance. Can be:
number: Time in millisecondsstring: Duration string (e.g., ‘01:00:00’ for 1 hour)
Promise<void>
pauseAt
Pauses time at the specified moment.number | string | Date
required
Time to pause at. Can be:
number: Unix timestamp in millisecondsstring: Date stringDate: Date object
Promise<void>
resume
Resumes normal time flow after it was paused.Promise<void>
runFor
Advances the clock by running all pending timers for the specified duration.number | string
required
Amount of time to run. Can be:
number: Time in millisecondsstring: Duration string (e.g., ‘00:05:00’ for 5 minutes)
Promise<void>
setFixedTime
Sets the clock to a fixed time. All subsequent time queries return this time.number | string | Date
required
Time to fix the clock at. Can be:
number: Unix timestamp in millisecondsstring: Date stringDate: Date object
Promise<void>
setSystemTime
Sets the current system time without affecting timers.number | string | Date
required
Time to set. Can be:
number: Unix timestamp in millisecondsstring: Date stringDate: Date object
Promise<void>
