Skip to content

getTimezoneOffset() returns -8 instead of -480 - Claude Code

Quick fix

Avoid local-time API on Windows; use timestamp differences or toISOString()/getUTC*, and wait for cc-switch to fix it.

Error output
重置 09-29 11:30 (UTC+0.13333333333333333)
English translation

Reset 09-29 11:30 (UTC+0.13333333333333333)

In the usage-query JavaScript sandbox of cc-switch 3.20.4 on Windows, QuickJS embedded by rquickjs-sys 0.8.1 divides the Windows time-zone offset in minutes by 60 again. Therefore, UTC+8 returns `-8` from `getTimezoneOffset()` instead of `-480`; local-time fields also treat 8 hours as 8 minutes.

This affects usage scripts that rely on `getHours()`, `getMinutes()`, local date fields, or local-time formatting. Countdowns that only calculate differences between two timestamps are unaffected. The maintainer has identified the cause and is preparing a fix that injects a time-zone shim into the script runtime.

  1. Change reset countdown logic to calculate only timestamp differences and avoid calling local-time API.

  2. When you need to display an absolute time, use `toISOString()` or `getUTC*` to obtain UTC time; these APIs were verified as correct in the reported environment.

  3. Wait for cc-switch to fix the time-zone shim for the Windows usage-script runtime.

ToolClaude Code
Version3.20.4(受影响)
PlatformsWindows

(No FAQ yet)

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.