@@ -283,21 +283,12 @@ export function RejectObjectWithCalendarOrTimeZone(item: AnyTemporalLikeType) {
283283 throw new TypeError ( 'with() does not support a timeZone property' ) ;
284284 }
285285}
286- function TemporalTimeZoneFromString ( stringIdent : string ) {
286+ function ParseTemporalTimeZone ( stringIdent : string ) {
287287 // TODO: why aren't these three variables destructured to include `undefined` as possible types?
288288 let { ianaName, offset, z } = ParseTemporalTimeZoneString ( stringIdent ) ;
289- let identifier = ianaName ;
290- if ( ! identifier && z ) identifier = 'UTC' ;
291- if ( ! identifier ) identifier = offset ;
292- const result = GetCanonicalTimeZoneIdentifier ( identifier ) ;
293- if ( offset && identifier !== offset ) {
294- const ns = ParseTemporalInstant ( stringIdent ) ;
295- const offsetNs = GetIANATimeZoneOffsetNanoseconds ( ns , result ) ;
296- if ( FormatTimeZoneOffsetString ( offsetNs ) !== offset ) {
297- throw new RangeError ( `invalid offset ${ offset } [${ ianaName } ]` ) ;
298- }
299- }
300- return result ;
289+ if ( ianaName ) return ianaName ;
290+ if ( z ) return 'UTC' ;
291+ return offset ;
301292}
302293
303294function FormatCalendarAnnotation ( id : string , showCalendar : Temporal . ShowCalendarOption [ 'calendarName' ] ) {
@@ -2154,7 +2145,7 @@ export function ToTemporalTimeZone(temporalTimeZoneLikeParam: TimeZoneParams['fr
21542145 }
21552146 }
21562147 const identifier = ToString ( temporalTimeZoneLike ) ;
2157- const timeZone = TemporalTimeZoneFromString ( identifier ) ;
2148+ const timeZone = ParseTemporalTimeZone ( identifier ) ;
21582149 const TemporalTimeZone = GetIntrinsic ( '%Temporal.TimeZone%' ) ;
21592150 return new TemporalTimeZone ( timeZone ) ;
21602151}
@@ -5056,7 +5047,7 @@ export const SystemUTCEpochNanoSeconds: () => bigInt.BigInteger = (() => {
50565047export function SystemTimeZone ( ) {
50575048 const fmt = new IntlDateTimeFormat ( 'en-us' ) ;
50585049 const TemporalTimeZone = GetIntrinsic ( '%Temporal.TimeZone%' ) ;
5059- return new TemporalTimeZone ( TemporalTimeZoneFromString ( fmt . resolvedOptions ( ) . timeZone ) ) ;
5050+ return new TemporalTimeZone ( ParseTemporalTimeZone ( fmt . resolvedOptions ( ) . timeZone ) ) ;
50605051}
50615052
50625053export function ComparisonResult ( value : number ) {
0 commit comments