@@ -353,24 +353,24 @@ DefineIntrinsic('Temporal.Calendar.from', Calendar.from);
353
353
*/
354
354
impl [ 'iso8601' ] = {
355
355
dateFromFields ( fieldsParam , options , calendar ) {
356
- const overflow = ES . ToTemporalOverflow ( options ) ;
357
356
let fields = ES . PrepareTemporalFields ( fieldsParam , [ 'day' , 'month' , 'monthCode' , 'year' ] , [ 'year' , 'day' ] ) ;
357
+ const overflow = ES . ToTemporalOverflow ( options ) ;
358
358
fields = resolveNonLunisolarMonth ( fields ) ;
359
359
let { year, month, day } = fields ;
360
360
( { year, month, day } = ES . RegulateISODate ( year , month , day , overflow ) ) ;
361
361
return ES . CreateTemporalDate ( year , month , day , calendar ) ;
362
362
} ,
363
363
yearMonthFromFields ( fieldsParam , options , calendar ) {
364
- const overflow = ES . ToTemporalOverflow ( options ) ;
365
364
let fields = ES . PrepareTemporalFields ( fieldsParam , [ 'month' , 'monthCode' , 'year' ] , [ 'year' ] ) ;
365
+ const overflow = ES . ToTemporalOverflow ( options ) ;
366
366
fields = resolveNonLunisolarMonth ( fields ) ;
367
367
let { year, month } = fields ;
368
368
( { year, month } = ES . RegulateISOYearMonth ( year , month , overflow ) ) ;
369
369
return ES . CreateTemporalYearMonth ( year , month , calendar , /* referenceISODay = */ 1 ) ;
370
370
} ,
371
371
monthDayFromFields ( fieldsParam , options , calendar ) {
372
- const overflow = ES . ToTemporalOverflow ( options ) ;
373
372
let fields = ES . PrepareTemporalFields ( fieldsParam , [ 'day' , 'month' , 'monthCode' , 'year' ] , [ 'day' ] ) ;
373
+ const overflow = ES . ToTemporalOverflow ( options ) ;
374
374
if ( fields . month !== undefined && fields . year === undefined && fields . monthCode === undefined ) {
375
375
throw new TypeError ( 'either year or monthCode required with month' ) ;
376
376
}
@@ -2287,11 +2287,11 @@ class NonIsoCalendar implements CalendarImpl {
2287
2287
options : NonNullable < Params [ 'dateFromFields' ] [ 1 ] > ,
2288
2288
calendar : Temporal . Calendar
2289
2289
) : Temporal . PlainDate {
2290
- const overflow = ES . ToTemporalOverflow ( options ) ;
2291
2290
const cache = new OneObjectCache ( ) ;
2292
2291
const fieldNames = this . fields ( [ 'day' , 'month' , 'monthCode' , 'year' ] ) as readonly AnyTemporalKey [ ] ;
2293
2292
ArrayPrototypeSort . call ( fieldNames ) ;
2294
2293
const fields = ES . PrepareTemporalFields ( fieldsParam , fieldNames , [ ] ) ;
2294
+ const overflow = ES . ToTemporalOverflow ( options ) ;
2295
2295
const { year, month, day } = this . helper . calendarToIsoDate ( fields , overflow , cache ) ;
2296
2296
const result = ES . CreateTemporalDate ( year , month , day , calendar ) ;
2297
2297
cache . setObject ( result ) ;
@@ -2302,11 +2302,11 @@ class NonIsoCalendar implements CalendarImpl {
2302
2302
options : NonNullable < Params [ 'yearMonthFromFields' ] [ 1 ] > ,
2303
2303
calendar : Temporal . Calendar
2304
2304
) : Temporal . PlainYearMonth {
2305
- const overflow = ES . ToTemporalOverflow ( options ) ;
2306
2305
const cache = new OneObjectCache ( ) ;
2307
2306
const fieldNames = this . fields ( [ 'month' , 'monthCode' , 'year' ] ) as readonly AnyTemporalKey [ ] ;
2308
2307
ArrayPrototypeSort . call ( fieldNames ) ;
2309
2308
const fields = ES . PrepareTemporalFields ( fieldsParam , fieldNames , [ ] ) ;
2309
+ const overflow = ES . ToTemporalOverflow ( options ) ;
2310
2310
const { year, month, day } = this . helper . calendarToIsoDate ( { ...fields , day : 1 } , overflow , cache ) ;
2311
2311
const result = ES . CreateTemporalYearMonth ( year , month , calendar , /* referenceISODay = */ day ) ;
2312
2312
cache . setObject ( result ) ;
@@ -2317,13 +2317,13 @@ class NonIsoCalendar implements CalendarImpl {
2317
2317
options : NonNullable < Params [ 'monthDayFromFields' ] [ 1 ] > ,
2318
2318
calendar : Temporal . Calendar
2319
2319
) : Temporal . PlainMonthDay {
2320
- const overflow = ES . ToTemporalOverflow ( options ) ;
2321
2320
const cache = new OneObjectCache ( ) ;
2322
2321
// For lunisolar calendars, either `monthCode` or `year` must be provided
2323
2322
// because `month` is ambiguous without a year or a code.
2324
2323
const fieldNames = this . fields ( [ 'day' , 'month' , 'monthCode' , 'year' ] ) as readonly AnyTemporalKey [ ] ;
2325
2324
ArrayPrototypeSort . call ( fieldNames ) ;
2326
2325
const fields = ES . PrepareTemporalFields ( fieldsParam , fieldNames , [ ] ) ;
2326
+ const overflow = ES . ToTemporalOverflow ( options ) ;
2327
2327
const { year, month, day } = this . helper . monthDayFromFields ( fields , overflow , cache ) ;
2328
2328
// `year` is a reference year where this month/day exists in this calendar
2329
2329
const result = ES . CreateTemporalMonthDay ( month , day , calendar , /* referenceISOYear = */ year ) ;
0 commit comments