MCPcopy Create free account
hub / github.com/angular/angular / convertTimezoneToLocal

Function convertTimezoneToLocal

packages/common/src/i18n/format_date.ts:905–910  ·  view source on GitHub ↗
(date: Date, timezone: string, reverse: boolean)

Source from the content-addressed store, hash-verified

903}
904
905function convertTimezoneToLocal(date: Date, timezone: string, reverse: boolean): Date {
906 const reverseValue = reverse ? -1 : 1;
907 const dateTimezoneOffset = date.getTimezoneOffset();
908 const timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
909 return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
910}
911
912/**
913 * Converts a value to date.

Callers 1

formatDateFunction · 0.85

Calls 2

timezoneToOffsetFunction · 0.85
addDateMinutesFunction · 0.85

Tested by

no test coverage detected