Skip to main content

Function: formatDayTimeInTz()

formatDayTimeInTz(instant, timeZone): string

Defined in: src/lib/dates/tz.ts:162

Day-and-time label (e.g. Tue, 9:00 PM) of instant in timeZone, for display.

Includes the weekday because the whole point of rendering an instant in a second timezone is that the day may differ from the one it is filed under — see crossesViewerMidnight.

Parameters

instant

Date

The absolute point in time (a UTC-based Date) to render.

timeZone

string

IANA timezone identifier (e.g. Asia/Manila).

Returns

string

A localized short weekday + 12-hour time, e.g. Tue, 9:00 PM.

Throws

RangeError If timeZone is not a valid IANA identifier, or if instant is invalid.