A browser extension to fake the current date and time in JavaScript Date
or Intl.DateTimeFormat
objects, to help you debug time-dependent frontend applications without having to change the system time.
time-travel-1.3.6.demo.mp4
- Open the tab you want to change the time in.
- Click the Extensions icon in the toolbar, then click Time Travel.
- Edit the date and time in the input field directly, or click the calendar icon to choose the date visually.
- Confirm with
Enter
or by clicking the "Change Date" button. In chrome, when first activating the extension on a tab, the page needs to be reloaded once to apply the changes. - Any JavaScript
Date
orIntl.DateTimeFormat
in the current tab now returns the fake date/time you set.
To restore the system time, click the extension icon and press Reset.
When the fake time is turned on, the clock is paused by default. Press the play (▶) button to make the fake clock tick forward at a normal rate, press stop (⏹) to pause the clock.
2023-04-27 12:40
- Local time2023-04-27
- Midnight UTC2025-03-30 00:59:55
- Assuming your system timezone is Europe/London (GMT), 5 seconds before a one-hour jump to 2 a.m. (summer time)2023-04-27T12:40Z
- Set local equivalent for given UTC time2023-04-27T12:40+1130
- Set local equivalent for time with +11:30 timezone offset. Note that actual time zone is not changed2023-03-25T12:40:00.120
- Local time with milliseconds1731493140025
- UNIX timestamp
- Fakes date and time for all methods of
Date
andIntl.DateTimeFormat
objects. - Time can be stopped and resumed.
- Minimal permissions, only affects current tab after clicking the extension icon. (Only in Chrome)
- Only JavaScript is affected by the extension.
- Some functionality or animations may behave strangely if the clock is stopped. Try resuming the clock via the ▶ button in that case.
- The extension does not work in iframes with the
sandbox
attribute.
For Chrome, Edge, and other Chromium-based browsers, install the extension from the Chrome Web Store: https://chrome.google.com/webstore/detail/time-travel/jfdbpgcmmenmelcghpbbkldkcfiejcjg
For Firefox, install it from: https://addons.mozilla.org/en-US/firefox/addon/timetravel/
To build and use a local version:
- Clone this repository and run
pnpm install
. - Run
pnpm dev
(orpnpm build
for a production version).
- Open chrome://extensions and enable 'Developer Mode'.
- Click 'Load unpacked' and select the
dist/chrome
directory
Change into dist/firefox and start npx web-ext run
to start a new Firefox instance with the extension loaded.
Or, manually
- Open about:debugging
- Navigate to 'This Firefox'
- Click 'Temporary Extensions' > 'Load Temporary Add-on...' and select
dist/firefox/manifest.json
.