@@ -283,21 +283,12 @@ export function RejectObjectWithCalendarOrTimeZone(item: AnyTemporalLikeType) {
283
283
throw new TypeError ( 'with() does not support a timeZone property' ) ;
284
284
}
285
285
}
286
- function TemporalTimeZoneFromString ( stringIdent : string ) {
286
+ function ParseTemporalTimeZone ( stringIdent : string ) {
287
287
// TODO: why aren't these three variables destructured to include `undefined` as possible types?
288
288
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 ;
301
292
}
302
293
303
294
function FormatCalendarAnnotation ( id : string , showCalendar : Temporal . ShowCalendarOption [ 'calendarName' ] ) {
@@ -2154,7 +2145,7 @@ export function ToTemporalTimeZone(temporalTimeZoneLikeParam: TimeZoneParams['fr
2154
2145
}
2155
2146
}
2156
2147
const identifier = ToString ( temporalTimeZoneLike ) ;
2157
- const timeZone = TemporalTimeZoneFromString ( identifier ) ;
2148
+ const timeZone = ParseTemporalTimeZone ( identifier ) ;
2158
2149
const TemporalTimeZone = GetIntrinsic ( '%Temporal.TimeZone%' ) ;
2159
2150
return new TemporalTimeZone ( timeZone ) ;
2160
2151
}
@@ -5056,7 +5047,7 @@ export const SystemUTCEpochNanoSeconds: () => bigInt.BigInteger = (() => {
5056
5047
export function SystemTimeZone ( ) {
5057
5048
const fmt = new IntlDateTimeFormat ( 'en-us' ) ;
5058
5049
const TemporalTimeZone = GetIntrinsic ( '%Temporal.TimeZone%' ) ;
5059
- return new TemporalTimeZone ( TemporalTimeZoneFromString ( fmt . resolvedOptions ( ) . timeZone ) ) ;
5050
+ return new TemporalTimeZone ( ParseTemporalTimeZone ( fmt . resolvedOptions ( ) . timeZone ) ) ;
5060
5051
}
5061
5052
5062
5053
export function ComparisonResult ( value : number ) {
0 commit comments