Skip to content

Documentation / jalali-js / zonedWallClockToInstant

Function: zonedWallClockToInstant()

zonedWallClockToInstant(fields, timeZone): number

Defined in: timezone.ts:61

Converts wall-clock fields observed in timeZone to the UTC instant they represent, in epoch milliseconds. Uses a two-pass offset lookup so a DST transition on the day in question does not throw off the result: the first pass estimates the offset assuming the wall clock was UTC, then a second pass re-reads the offset at that estimated instant and corrects for it. This is the same technique used by other timezone-aware date libraries; there is no single correct answer for a wall-clock time that a DST transition skips over entirely, but this never throws or produces NaN for one.

Parameters

fields

WallClockFields

timeZone

string

Returns

number