Skip to content

Documentation / jalali-js / resolveTimeZone

Function: resolveTimeZone()

resolveTimeZone(timeZone): string

Defined in: timezone.ts:119

Resolves 'auto' to a real IANA timezone name, or returns an already-explicit name as-is.

This is SSR-safe by construction: with no window global (a server render, in Node, in any framework), 'auto' resolves to 'UTC' rather than the server machine's own timezone. Resolving the server's real timezone here would bake a value into server-rendered output that the client almost certainly disagrees with, causing a hydration mismatch. A framework binding's useResolvedTimeZone()-style hook re-calls this function after mount, when window is defined, to pick up the browser's real timezone.

Parameters

timeZone

string

Returns

string