File tree Expand file tree Collapse file tree 4 files changed +7
-1
lines changed Expand file tree Collapse file tree 4 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ export class Calendar implements Temporal.Calendar {
141
141
}
142
142
}
143
143
get id ( ) : Return [ 'id' ] {
144
+ if ( ! ES . IsTemporalCalendar ( this ) ) throw new TypeError ( 'invalid receiver' ) ;
144
145
return ES . ToString ( this ) ;
145
146
}
146
147
dateFromFields (
@@ -334,6 +335,7 @@ export class Calendar implements Temporal.Calendar {
334
335
return GetSlot ( this , CALENDAR_ID ) ;
335
336
}
336
337
toJSON ( ) : Return [ 'toJSON' ] {
338
+ if ( ! ES . IsTemporalCalendar ( this ) ) throw new TypeError ( 'invalid receiver' ) ;
337
339
return ES . ToString ( this ) ;
338
340
}
339
341
static from ( item : Params [ 'from' ] [ 0 ] ) : Return [ 'from' ] {
Original file line number Diff line number Diff line change @@ -324,6 +324,7 @@ function ParseISODateTime(isoString: string) {
324
324
if ( ! match ) throw new RangeError ( `invalid ISO 8601 string: ${ isoString } ` ) ;
325
325
let yearString = match [ 1 ] ;
326
326
if ( yearString [ 0 ] === '\u2212' ) yearString = `-${ yearString . slice ( 1 ) } ` ;
327
+ if ( yearString === '-000000' ) throw new RangeError ( `invalid ISO 8601 string: ${ isoString } ` ) ;
327
328
const year = ToInteger ( yearString ) ;
328
329
const month = ToInteger ( match [ 2 ] || match [ 4 ] ) ;
329
330
const day = ToInteger ( match [ 3 ] || match [ 5 ] ) ;
@@ -451,6 +452,7 @@ function ParseTemporalYearMonthString(isoString: string) {
451
452
if ( match ) {
452
453
let yearString = match [ 1 ] ;
453
454
if ( yearString [ 0 ] === '\u2212' ) yearString = `-${ yearString . slice ( 1 ) } ` ;
455
+ if ( yearString === '-000000' ) throw new RangeError ( `invalid ISO 8601 string: ${ isoString } ` ) ;
454
456
year = ToInteger ( yearString ) ;
455
457
month = ToInteger ( match [ 2 ] ) ;
456
458
calendar = match [ 3 ] ;
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ export class TimeZone implements Temporal.TimeZone {
43
43
}
44
44
}
45
45
get id ( ) : Return [ 'id' ] {
46
+ if ( ! ES . IsTemporalTimeZone ( this ) ) throw new TypeError ( 'invalid receiver' ) ;
46
47
return ES . ToString ( this ) ;
47
48
}
48
49
getOffsetNanosecondsFor ( instantParam : Params [ 'getOffsetNanosecondsFor' ] [ 0 ] ) : Return [ 'getOffsetNanosecondsFor' ] {
@@ -150,6 +151,7 @@ export class TimeZone implements Temporal.TimeZone {
150
151
return ES . ToString ( GetSlot ( this , TIMEZONE_ID ) ) ;
151
152
}
152
153
toJSON ( ) : Return [ 'toJSON' ] {
154
+ if ( ! ES . IsTemporalTimeZone ( this ) ) throw new TypeError ( 'invalid receiver' ) ;
153
155
return ES . ToString ( this ) ;
154
156
}
155
157
static from ( item : Params [ 'from' ] [ 0 ] ) : Return [ 'from' ] {
You can’t perform that action at this time.
0 commit comments