Firefox 浏览器附加组件
  • 扩展
  • 主题
    • 适用于 Firefox
    • 字典和语言包
登录
Time Travel 预览

Time Travel 作者: Christian Pulvermacher

在 JavaScript Date、Intl.DateTimeFormat 或 Temporal 对象中模拟当前的日期、时间和时区。 Time Travel 可帮助您调试与时间相关的前端应用,而无需更改系统时间。

可在 Android™ 版 Firefox 上使用可在 Android™ 版 Firefox 上使用
5(5 条评价)5(5 条评价)
1,217 个用户1,217 个用户
下载 Firefox 并安装扩展
下载文件
扫码在 Android 版 Firefox 中打开此扩展

扩展元数据

屏幕截图
Extension on, date changed to Oct 2032, clock stopped.Extension on, date and time zone changed, clock running.Extension off.
关于此扩展
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。
评分 5(1 位用户)
登录以评价此扩展
目前尚无评分

已保存星级评分

5
5
4
0
3
0
2
0
1
0
阅读全部 5 条评价
权限与数据

必要权限:

  • 访问您在所有网站的数据

收集的数据:

  • 开发者称此扩展无需收集数据。
详细了解
更多信息
附加组件链接
  • 用户支持网站
  • 复制附加组件 ID
版本
3.1.2
大小
103.07 KB
上次更新
1 个月前 (2026年10月25日)
相关分类
  • 网页开发
许可证
MIT 许可证
版本历史
  • 查看所有版本
添加到收藏集
举报此附加组件
转至 Mozilla 主页

附加组件

  • 关于
  • Firefox 附加组件博客
  • 扩展工坊
  • 开发者中心
  • 开发者政策
  • 社区博客
  • 论坛
  • 报告缺陷
  • 评价指南

下载

  • Download Firefox
  • Windows
  • macOS
  • iOS
  • Android
  • Linux
  • All

最新版本

  • Nightly
  • Beta

商用版 Firefox

  • Enterprise

社区

  • Connect
  • Contribute
  • Developer

关注

  • Instagram
  • YouTube
  • TikTok
  • Bluesky
  • Podcast
  • 隐私
  • Cookie
  • 法律

本站内容以知识共享署名-相同方式共享 v3.0 或任何更新版本授权(除非另有注明)。Android 系 Google LLC 的商标。