Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/jsc/bindings/JSEnvironmentVariableMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ static constexpr ASCIILiteral kProxyEnvVarNames[] = {
// side-effecting var need only be added in one place.
static void applyTZFromString(JSGlobalObject* globalObject, const String& value)
{
if (value.length() < 32 && WTF::setTimeZoneOverride(value)) {
if (WTF::setTimeZoneOverride(value)) {
WTF::timeZoneDidChange();
JSC::getVM(globalObject).dateCache.clearForTimeZoneChange();
}
Expand Down
19 changes: 19 additions & 0 deletions test/js/node/process/process.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,25 @@ it("process.env.TZ", () => {
expect(Intl.DateTimeFormat().resolvedOptions().timeZone).toBe(realOrigTimezone);
});

it("process.env.TZ accepts zone ids >= 32 chars", () => {
const origTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
try {
process.env.TZ = "Asia/Tokyo";
expect(Intl.DateTimeFormat().resolvedOptions().timeZone).toBe("Asia/Tokyo");

// "America/Argentina/ComodRivadavia" is exactly 32 chars and a valid IANA
// link zone. The runtime setter used to gate on length < 32, silently
// dropping it while the launch-time TZ path had no such cap.
const long = "America/Argentina/ComodRivadavia";
expect(long.length).toBe(32);
process.env.TZ = long;
expect(Intl.DateTimeFormat().resolvedOptions().timeZone).not.toBe("Asia/Tokyo");
expect(new Date("2026-07-27T15:00Z").getTimezoneOffset()).toBe(180);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
} finally {
process.env.TZ = origTimezone;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}
});

it("process.version starts with v", () => {
expect(process.version.startsWith("v")).toBeTruthy();
});
Expand Down
Loading