1
+ const ArrayIncludes = Array . prototype . includes ;
1
2
const ArrayPrototypePush = Array . prototype . push ;
2
3
const IntlDateTimeFormat = globalThis . Intl . DateTimeFormat ;
3
4
const MathMin = Math . min ;
@@ -36,7 +37,8 @@ import type {
36
37
DurationParams ,
37
38
PlainDateTimeParams ,
38
39
PlainYearMonthParams ,
39
- FieldRecord
40
+ FieldRecord ,
41
+ BuiltinCalendarId
40
42
} from './internaltypes' ;
41
43
import { GetIntrinsic } from './intrinsicclass' ;
42
44
import {
@@ -73,7 +75,6 @@ import {
73
75
MICROSECONDS ,
74
76
NANOSECONDS
75
77
} from './slots' ;
76
- import { IsBuiltinCalendar } from './calendar' ;
77
78
78
79
export const ZERO = JSBI . BigInt ( 0 ) ;
79
80
const ONE = JSBI . BigInt ( 1 ) ;
@@ -93,6 +94,28 @@ const ABOUT_TEN_YEARS_NANOS = JSBI.multiply(DAY_NANOS, JSBI.BigInt(366 * 10));
93
94
const ABOUT_ONE_YEAR_NANOS = JSBI . multiply ( DAY_NANOS , JSBI . BigInt ( 366 * 1 ) ) ;
94
95
const TWO_WEEKS_NANOS = JSBI . multiply ( DAY_NANOS , JSBI . BigInt ( 2 * 7 ) ) ;
95
96
97
+ const BUILTIN_CALENDAR_IDS = [
98
+ 'iso8601' ,
99
+ 'hebrew' ,
100
+ 'islamic' ,
101
+ 'islamic-umalqura' ,
102
+ 'islamic-tbla' ,
103
+ 'islamic-civil' ,
104
+ 'islamic-rgsa' ,
105
+ 'islamicc' ,
106
+ 'persian' ,
107
+ 'ethiopic' ,
108
+ 'ethioaa' ,
109
+ 'coptic' ,
110
+ 'chinese' ,
111
+ 'dangi' ,
112
+ 'roc' ,
113
+ 'indian' ,
114
+ 'buddhist' ,
115
+ 'japanese' ,
116
+ 'gregory'
117
+ ] ;
118
+
96
119
function IsInteger ( value : unknown ) : value is number {
97
120
if ( typeof value !== 'number' || ! NumberIsFinite ( value ) ) return false ;
98
121
const abs = MathAbs ( value ) ;
@@ -5293,6 +5316,10 @@ function GetNumberOption<P extends string, T extends Partial<Record<P, unknown>>
5293
5316
return MathFloor ( value ) ;
5294
5317
}
5295
5318
5319
+ export function IsBuiltinCalendar ( id : string ) : id is BuiltinCalendarId {
5320
+ return ArrayIncludes . call ( BUILTIN_CALENDAR_IDS , id ) ;
5321
+ }
5322
+
5296
5323
const OFFSET = new RegExp ( `^${ PARSE . offset . source } $` ) ;
5297
5324
5298
5325
function bisect (
0 commit comments