MCPcopy Create free account
hub / github.com/adobe/react-spectrum / toTimeZone

Function toTimeZone

packages/@internationalized/date/src/conversion.ts:381–384  ·  view source on GitHub ↗
(date: ZonedDateTime, timeZone: string)

Source from the content-addressed store, hash-verified

379
380/** Converts a `ZonedDateTime` from one time zone to another. */
381export function toTimeZone(date: ZonedDateTime, timeZone: string): ZonedDateTime {
382 let ms = epochFromDate(date) - date.offset;
383 return toCalendar(fromAbsolute(ms, timeZone), date.calendar);
384}
385
386/** Converts the given `ZonedDateTime` into the user's local time zone. */
387export function toLocalTimeZone(date: ZonedDateTime): ZonedDateTime {

Callers 3

parseAbsoluteFunction · 0.90
toZonedFunction · 0.85
toLocalTimeZoneFunction · 0.85

Calls 3

epochFromDateFunction · 0.85
toCalendarFunction · 0.85
fromAbsoluteFunction · 0.85

Tested by

no test coverage detected