Chrono Mock
LanguageEnglish

Changing the date in Chrome or Firefox for testing

The usual answers are an extension that overrides the date in a page, or the clock of a test framework. Chrono Mock starts the browser itself on a clock of its own - every tab and every worker, at any date, frozen or sped up - and leaves the Windows clock and every other program alone.

What the usual answers cover

ApproachWhat sees the new dateWhat it leaves out
A browser extensionThe JavaScript date of the pages it is allowed intoOften one tab at a time, and nothing tells you what it missed
Chrome DevToolsA time zone, set through a location in the Sensors panelThe date itself
A test framework's clockThe pages a test you write opensManual testing, and every page the test does not drive
The Windows clockEverything on the machineNothing, which is the problem: certificates, domain logon and time sync move too

Chrome

Chrome is started with a clean throwaway profile and a local debugging port, and every page and worker takes its JavaScript time from the session: Date.now, new Date(), performance.now, setTimeout, setInterval and the session time zone. The browser itself keeps the real date, so HTTPS sites keep loading - checked with a session set to 2040.

# Chrome at the last ten seconds of 2027, running sixty times faster
chrono run "C:\Program Files\Google\Chrome\Application\chrome.exe" --at 2027-12-31T23:59:50 --mode x60 --args "http://localhost:8080/"

The profile is not yours: no saved logins, no extensions, and it is deleted when the session ends. Other browsers built on Chromium work the same way. How the Chromium mode works →

Firefox

Firefox runs its pages in sandboxed processes the session cannot enter, so it needs --no-gecko-sandbox. The pages then start outside that sandbox, join the session and follow its clock, speed, jumps and time zone. Firefox runs without that protection until it closes, so open only pages you trust in it. Give it a profile of its own with -no-remote -profile and an empty folder, so it does not hand the page to a Firefox you already have open.

# Firefox at the last ten seconds of 2027, with a profile folder of its own
chrono run "C:\Program Files\Mozilla Firefox\firefox.exe" --at 2027-12-31T23:59:50 --no-gecko-sandbox --args "-no-remote -profile C:\ff-test http://localhost:8080/"

In Firefox the whole browser moves, not only its pages, and that includes its certificate checks: in a session set to 2040, a real HTTPS site showed a security warning. Pages from a file, a test server you run, or a date the site's certificate still covers are the case that works.

Started as administrator, Firefox drops the rights and restarts outside the session unless --no-deelevate is among its arguments, and the session says so from the start.

Knowing that the pages got the date

The report says which pages and workers the session reached and which kept the real clock - per JavaScript context in Chrome, per process in Firefox. What the report says →

What it does not do

  • The server side. A date a site gets from its server stays the server's date.
  • Your everyday browser. The session starts a browser of its own. It does not attach to the one you have open, and leaves its tabs and logins alone.

Try it