@welldot/utils
localDateTimeToInstant
Converts a local date and time in an IANA time zone to an RFC 3339 instant carrying the zone's offset at that local time.
localDateTimeToInstant(
local,timeZone):string|undefined
Converts a local date and time in an IANA time zone to an RFC 3339 instant carrying the zone's offset at that local time.
Parameters
local
string
YYYY-MM-DDTHH:mm[:ss].
timeZone
string
IANA zone name.
Returns
string | undefined
The instant (2026-07-15T12:00:00-04:00), or undefined when the
zone or the local string is invalid. A local time that happens twice
(clocks go back) resolves to its first occurrence, with the offset before
the change. A local time that never happens (clocks go forward) takes the
offset in force before the change, so 02:30 in a spring-forward gap in
New York is 02:30:00-05:00.