@@ -94,8 +94,8 @@ export class CalendarDate {
9494 }
9595
9696 /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
97- set ( fields : DateFields ) : CalendarDate {
98- return set ( this , fields ) ;
97+ set ( fields : DateFields , ignoreDay ?: boolean ) : CalendarDate {
98+ return set ( this , fields , ignoreDay ) ;
9999 }
100100
101101 /**
@@ -165,8 +165,8 @@ export class Time {
165165 }
166166
167167 /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */
168- set ( fields : TimeFields ) : Time {
169- return setTime ( this , fields ) ;
168+ set ( fields : TimeFields , ignoreDay ?: boolean ) : Time {
169+ return setTime ( this , fields , ignoreDay ) ;
170170 }
171171
172172 /**
@@ -264,13 +264,13 @@ export class CalendarDateTime {
264264 * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
265265 * When the resulting value reaches the limits of the field, it wraps around.
266266 */
267- cycle ( field : DateField | TimeField , amount : number , options ?: CycleTimeOptions ) : CalendarDateTime {
267+ cycle ( field : DateField | TimeField , amount : number , options ?: CycleTimeOptions , ignoreDay ?: boolean ) : CalendarDateTime {
268268 switch ( field ) {
269269 case 'era' :
270270 case 'year' :
271271 case 'month' :
272272 case 'day' :
273- return cycleDate ( this , field , amount , options ) ;
273+ return cycleDate ( this , field , amount , options , ignoreDay ) ;
274274 default :
275275 return cycleTime ( this , field , amount , options ) ;
276276 }
@@ -329,10 +329,10 @@ export class ZonedDateTime {
329329 /** The UTC offset for this time, in milliseconds. */
330330 public readonly offset : number ;
331331
332- constructor ( year : number , month : number , day : number , timeZone : string , offset : number , hour ?: number , minute ?: number , second ?: number , millisecond ?: number ) ;
333- constructor ( era : string , year : number , month : number , day : number , timeZone : string , offset : number , hour ?: number , minute ?: number , second ?: number , millisecond ?: number ) ;
334- constructor ( calendar : Calendar , year : number , month : number , day : number , timeZone : string , offset : number , hour ?: number , minute ?: number , second ?: number , millisecond ?: number ) ;
335- constructor ( calendar : Calendar , era : string , year : number , month : number , day : number , timeZone : string , offset : number , hour ?: number , minute ?: number , second ?: number , millisecond ?: number ) ;
332+ constructor ( year : number , month : number , day : number , timeZone : string , offset : number , hour ?: number , minute ?: number , second ?: number , millisecond ?: number , ignoreDay ?: boolean ) ;
333+ constructor ( era : string , year : number , month : number , day : number , timeZone : string , offset : number , hour ?: number , minute ?: number , second ?: number , millisecond ?: number , ignoreDay ?: boolean ) ;
334+ constructor ( calendar : Calendar , year : number , month : number , day : number , timeZone : string , offset : number , hour ?: number , minute ?: number , second ?: number , millisecond ?: number , ignoreDay ?: boolean ) ;
335+ constructor ( calendar : Calendar , era : string , year : number , month : number , day : number , timeZone : string , offset : number , hour ?: number , minute ?: number , second ?: number , millisecond ?: number , ignoreDay ?: boolean ) ;
336336 constructor ( ...args : any [ ] ) {
337337 let [ calendar , era , year , month , day ] = shiftArgs ( args ) ;
338338 let timeZone = args . shift ( ) ;
@@ -348,16 +348,17 @@ export class ZonedDateTime {
348348 this . minute = args . shift ( ) || 0 ;
349349 this . second = args . shift ( ) || 0 ;
350350 this . millisecond = args . shift ( ) || 0 ;
351+ const ignoreDay = args . shift ( ) || 0 ;
351352
352- constrain ( this ) ;
353+ constrain ( this , ignoreDay ) ;
353354 }
354355
355356 /** Returns a copy of this date. */
356- copy ( ) : ZonedDateTime {
357+ copy ( ignoreDay ?: boolean ) : ZonedDateTime {
357358 if ( this . era ) {
358- return new ZonedDateTime ( this . calendar , this . era , this . year , this . month , this . day , this . timeZone , this . offset , this . hour , this . minute , this . second , this . millisecond ) ;
359+ return new ZonedDateTime ( this . calendar , this . era , this . year , this . month , this . day , this . timeZone , this . offset , this . hour , this . minute , this . second , this . millisecond , ignoreDay ) ;
359360 } else {
360- return new ZonedDateTime ( this . calendar , this . year , this . month , this . day , this . timeZone , this . offset , this . hour , this . minute , this . second , this . millisecond ) ;
361+ return new ZonedDateTime ( this . calendar , this . year , this . month , this . day , this . timeZone , this . offset , this . hour , this . minute , this . second , this . millisecond , ignoreDay ) ;
361362 }
362363 }
363364
@@ -372,16 +373,16 @@ export class ZonedDateTime {
372373 }
373374
374375 /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
375- set ( fields : DateFields & TimeFields , disambiguation ?: Disambiguation ) : ZonedDateTime {
376- return setZoned ( this , fields , disambiguation ) ;
376+ set ( fields : DateFields & TimeFields , disambiguation ?: Disambiguation , ignoreDay ?: boolean ) : ZonedDateTime {
377+ return setZoned ( this , fields , disambiguation , ignoreDay ) ;
377378 }
378379
379380 /**
380381 * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
381382 * When the resulting value reaches the limits of the field, it wraps around.
382383 */
383- cycle ( field : DateField | TimeField , amount : number , options ?: CycleTimeOptions ) : ZonedDateTime {
384- return cycleZoned ( this , field , amount , options ) ;
384+ cycle ( field : DateField | TimeField , amount : number , options ?: CycleTimeOptions , ignoreDay ?: boolean ) : ZonedDateTime {
385+ return cycleZoned ( this , field , amount , options , ignoreDay ) ;
385386 }
386387
387388 /** Converts the date to a native JavaScript Date object. */
0 commit comments