Time Travel
Christian Pulvermacher · Firefox
在 JavaScript Date、Intl.DateTimeFormat 或 Temporal 对象中模拟当前的日期、时间和时区。 Time Travel 可帮助您调试与时间相关的前端应用,而无需更改系统时间。
<all_urls>),意味着它可以读取你在任意站点的页面内容,包括已登录的页面。这是许多扩展正常工作的必要条件,但也值得你确认来源可信。
截图
简介
Features:
- Fakes date and time for all methods of Date and Intl.DateTimeFormat objects, and for Temporal.Now where the browser supports it.
- Time zone can be changed, with full support for DST transitions.
- Time can be stopped and resumed.
- Option to automatically reload page after changing date.
- Only affects current tab after clicking the extension icon.
Limitations:
- Only JavaScript is affected by the extension.
- Some functionality or animations may behave strangely if the clock is stopped.
- The extension does not work in iframes with the sandbox attribute.
Usage:
- Open the tab you want to change the time in.
- Click the Extensions icon in the toolbar, then click Time Travel.
- Choose a date from the calendar and edit the time if necessary, or enter a date and time directly (see examples below).
- Confirm with Enter or by clicking the apply button, which shows a preview of the change to apply (e.g. "Change date to Apr 27, 2025 12:40").
- Any JavaScript Date, Intl.DateTimeFormat or Temporal.Now in the current tab now returns the fake date/time you set. Other tabs and origins are not affected.
To restore the system time, click the extension icon and switch off the "Fake JavaScript date" toggle, or clear the input field and press Enter.
When the fake date is enabled, the clock runs forward from the configured time. The current page time is shown under "Page sees:", which also displays the real time while the extension is off.
You can stop the clock by switching on the "Stop clock" toggle. The fake date will be reset to the last value you set.
To change the time zone, enable "Change time zone" and select a time zone from the dropdown.
When enabled, Date objects, Intl.DateTimeFormat and Temporal.Now will use this time zone instead of the system time zone.
Date and time input is then interpreted as local time in the selected time zone as well (input label shows e.g. "Set date and time (London)").
Switching to a different time zone keeps the entered local date and time, which may change the instant (unless the input field contains a UTC instant).
A badge next to the effective page time shows the UTC offset in use, with an icon marking whether the date falls into daylight saving time or standard time.
Hovering over the badge will show further details.
Example Dates and Formats:
- 2025-04-27 12:40 - Local time
- 2025-03-30 00:59:55 - Assuming your system time zone is Europe/London (GMT), 5 seconds before a one-hour jump to 2 a.m. (summer time)
- 2025-04-27T12:40Z - Set local equivalent for given UTC time
- 2025-04-27T12:40+1130 - Set local equivalent for time with +11:30 time zone offset. Note that actual time zone is not changed
- 2025-03-25T12:40:00.120 - Local time with milliseconds
- 1731493140025 - UNIX timestamp
This extension is open source software licensed under the MIT license.
If you have ideas, bug reports, or want to help improve Time Travel, please open an issue on GitHub.功能:
- 模拟 Date 和 Intl.DateTimeFormat 对象所有方法的日期和时间;如果浏览器支持,也会模拟 Temporal.Now。
- 可更改时区,并完整支持夏令时的切换。
- 可停止和恢复时钟。
- 可选择在更改日期后自动重新加载页面。
- 点击扩展程序图标后,只会影响当前标签页。
限制:
- 扩展程序只影响 JavaScript。
- 时钟停止时,部分功能或动画可能会出现异常。
- 扩展程序无法在带有 sandbox 属性的 iframe 中运行。
使用方法:
- 打开要更改时间的标签页。
- 点击工具栏中的“扩展程序”图标,然后点击 Time Travel。
- 从日历中选择日期并根据需要编辑时间,或直接输入日期和时间(请参阅下方示例)。
- 按 Enter 或点击应用按钮确认。按钮会预览将要应用的更改(例如“将日期更改为 2025年4月27日 12:40”)。
- 当前标签页中的所有 JavaScript Date、Intl.DateTimeFormat 或 Temporal.Now 都会返回您设置的模拟日期和时间。其他标签页和来源不受影响。
要恢复系统时间,请点击扩展程序图标并关闭“模拟 JavaScript 日期”开关,或清空输入框后按 Enter。
启用模拟日期后,时钟会从设置的时间开始继续走动。当前页面时间显示在“页面时间:”下方;扩展程序关闭时,这里显示实际时间。
打开“停止时钟”开关即可停止时钟,模拟日期会重置为您最后设置的值。
要更改时区,请启用“更改时区”,然后从下拉菜单中选择时区。
启用后,Date 对象、Intl.DateTimeFormat 和 Temporal.Now 将使用此时区,而不是系统时区。
输入的日期和时间也会被解释为所选时区的本地时间(输入框标签会显示例如“设置日期和时间(伦敦)”)。
切换到其他时区时,会保留输入的本地日期和时间,因此实际的时间点可能会改变(除非输入框中是 UTC 时间)。
实际页面时间旁的徽章会显示当前使用的 UTC 偏移,并用图标标明该日期处于夏令时还是标准时间。
将鼠标悬停在徽章上即可查看更多详细信息。
日期与格式示例:
- 2025-04-27 12:40 - 本地时间
- 2025-03-30 00:59:55 - 假设系统时区为 Europe/London (GMT),即时间向前跳一小时到凌晨 2 点(夏令时)前 5 秒
- 2025-04-27T12:40Z - 设置为指定 UTC 时间对应的本地时间
- 2025-04-27T12:40+1130 - 设置为 +11:30 时区偏移时间对应的本地时间。请注意,实际时区不会更改
- 2025-03-25T12:40:00.120 - 带毫秒的本地时间
- 1731493140025 - UNIX 时间戳
此扩展程序为开源软件,采用 MIT 许可证。
如果您有任何想法、错误报告,或想帮助改进 Time Travel,欢迎在 GitHub 上提交 issue。
Time Travel 是做什么的
Time Travel 是一款面向 Firefox 的开发者工具类扩展,主要用来调试页面、查看样式与请求、测试接口、辅助前端开发。官方对它的介绍是:在 JavaScript Date、Intl.DateTimeFormat 或 Temporal 对象中模拟当前的日期、时间和时区。 Time Travel 可帮助您调试与时间相关的前端应用,而无需更改系统时间。在Firefox 附加组件商店(AMO)上,它当前版本 3.1.2,评分 5(5 人评价),约 1,116 名用户。
适合什么人用
从功能定位看,Time Travel 更适合前端工程师、测试与需要经常查看页面结构的用户。如果你平时只是偶尔遇到相关需求,用浏览器自带功能也能凑合;但如果这件事每天都发生,装一个专门处理它的扩展通常比手动操作省事得多。需要注意的是它作用于所有网站,装上后建议先观察一两天,确认不影响常用站点的正常使用。
怎么安装 Time Travel
- 打开Firefox 附加组件商店(AMO)上的官方页面;
- 点「添加到浏览器」并确认权限提示;
- 装好后在扩展列表里固定图标,方便随时开关。
本站只做索引与介绍,安装包来自官方商店。如果商店页面提示当前地区不可用,说明该扩展未在你所在区域上架。
常见问题
Time Travel 是免费的吗?
Time Travel 在Firefox 附加组件商店(AMO)免费提供下载。它是浏览器扩展,装上就能直接用,不需要注册账号。
Time Travel 安全吗?
它只申请了 0 项权限,范围比较克制,没有申请「读取所有网站数据」这种大权限。
Time Travel 支持哪些浏览器?
当前收录的版本来自Firefox 附加组件商店(AMO),适用于 Firefox。同一个扩展在其他商店可能有对应版本,但功能与版本号不一定相同。
怎么卸载 Time Travel?
在扩展管理页找到 Time Travel,点移除即可。它在本地保存的设置会一起清掉,不会残留数据。
权限清单 来自 manifest.json 原文
站点访问 2
http://*/*https://*/*
接口权限 3
activeTabscriptingstorage


