@@ -37,7 +37,7 @@ describe('CalendarDate manipulation', function () {
3737
3838 it ( 'should add months and constrain days' , function ( ) {
3939 let date = new CalendarDate ( 2020 , 8 , 31 ) ;
40- expect ( date . add ( { months : 1 } ) ) . toEqual ( new CalendarDate ( 2020 , 10 , 1 ) ) ;
40+ expect ( date . add ( { months : 1 } ) ) . toEqual ( new CalendarDate ( 2020 , 9 , 30 ) ) ;
4141 } ) ;
4242
4343 it ( 'should add days' , function ( ) {
@@ -217,7 +217,7 @@ describe('CalendarDate manipulation', function () {
217217
218218 it ( 'should constrain when reaching year 9919' , function ( ) {
219219 let date = new CalendarDate ( new IndianCalendar ( ) , 9919 , 12 , 10 ) ;
220- expect ( date . add ( { months : 1 } ) ) . toEqual ( new CalendarDate ( new IndianCalendar ( ) , 9919 , 12 , 30 ) ) ;
220+ expect ( date . add ( { months : 1 } ) ) . toEqual ( new CalendarDate ( new IndianCalendar ( ) , 9919 , 12 , 31 ) ) ;
221221 } ) ;
222222 } ) ;
223223
@@ -229,7 +229,7 @@ describe('CalendarDate manipulation', function () {
229229
230230 it ( 'should constrain when reaching year 9377' , function ( ) {
231231 let date = new CalendarDate ( new PersianCalendar ( ) , 9377 , 12 , 10 ) ;
232- expect ( date . add ( { months : 1 } ) ) . toEqual ( new CalendarDate ( new PersianCalendar ( ) , 9377 , 12 , 30 ) ) ;
232+ expect ( date . add ( { months : 1 } ) ) . toEqual ( new CalendarDate ( new PersianCalendar ( ) , 9377 , 12 , 31 ) ) ;
233233 } ) ;
234234 } ) ;
235235
@@ -248,7 +248,7 @@ describe('CalendarDate manipulation', function () {
248248 describe ( 'CopticCalendar' , function ( ) {
249249 it ( 'should rebalance era when subtracting' , function ( ) {
250250 let date = new CalendarDate ( new CopticCalendar ( ) , 1 , 1 , 12 ) ;
251- expect ( date . subtract ( { months : 1 } ) ) . toEqual ( new CalendarDate ( new CopticCalendar ( ) , 'CE ' , 1 , 1 , 7 ) ) ;
251+ expect ( date . subtract ( { months : 1 } ) ) . toEqual ( new CalendarDate ( new CopticCalendar ( ) , 'BCE ' , 1 , 13 , 5 ) ) ;
252252 } ) ;
253253
254254 it ( 'should rebalance era when adding' , function ( ) {
@@ -353,7 +353,7 @@ describe('CalendarDate manipulation', function () {
353353
354354 it ( 'should subtract months and constrain days' , function ( ) {
355355 let date = new CalendarDate ( 2020 , 10 , 31 ) ;
356- expect ( date . subtract ( { months : 1 } ) ) . toEqual ( new CalendarDate ( 2020 , 10 , 1 ) ) ;
356+ expect ( date . subtract ( { months : 1 } ) ) . toEqual ( new CalendarDate ( 2020 , 9 , 30 ) ) ;
357357 } ) ;
358358
359359 it ( 'should subtract days' , function ( ) {
@@ -529,7 +529,7 @@ describe('CalendarDate manipulation', function () {
529529
530530 it ( 'should set month and constrain day' , function ( ) {
531531 let date = new CalendarDate ( 2020 , 8 , 31 ) ;
532- expect ( date . set ( { month : 9 } ) ) . toEqual ( new CalendarDate ( 2020 , 9 , 31 ) ) ;
532+ expect ( date . set ( { month : 9 } ) ) . toEqual ( new CalendarDate ( 2020 , 9 , 30 ) ) ;
533533 } ) ;
534534
535535 it ( 'should set day' , function ( ) {
@@ -539,15 +539,15 @@ describe('CalendarDate manipulation', function () {
539539
540540 it ( 'should constrain day' , function ( ) {
541541 let date = new CalendarDate ( 2020 , 9 , 3 ) ;
542- expect ( date . set ( { day : 31 } ) ) . toEqual ( new CalendarDate ( 2020 , 9 , 31 ) ) ;
542+ expect ( date . set ( { day : 31 } ) ) . toEqual ( new CalendarDate ( 2020 , 9 , 30 ) ) ;
543543 } ) ;
544544
545545 it ( 'should constrain day on leap years' , function ( ) {
546546 let date = new CalendarDate ( 2020 , 2 , 3 ) ;
547- expect ( date . set ( { day : 31 } ) ) . toEqual ( new CalendarDate ( 2020 , 2 , 31 ) ) ;
547+ expect ( date . set ( { day : 31 } ) ) . toEqual ( new CalendarDate ( 2020 , 2 , 29 ) ) ;
548548
549549 date = new CalendarDate ( 2019 , 2 , 3 ) ;
550- expect ( date . set ( { day : 31 } ) ) . toEqual ( new CalendarDate ( 2019 , 2 , 31 ) ) ;
550+ expect ( date . set ( { day : 31 } ) ) . toEqual ( new CalendarDate ( 2019 , 2 , 28 ) ) ;
551551 } ) ;
552552
553553 describe ( 'Japanese calendar' , function ( ) {
@@ -639,7 +639,7 @@ describe('CalendarDate manipulation', function () {
639639
640640 it ( 'should constrain the day on leap years' , function ( ) {
641641 let date = new CalendarDate ( 2020 , 2 , 29 ) ;
642- expect ( date . cycle ( 'year' , 1 ) ) . toEqual ( new CalendarDate ( 2021 , 2 , 29 ) ) ;
642+ expect ( date . cycle ( 'year' , 1 ) ) . toEqual ( new CalendarDate ( 2021 , 2 , 28 ) ) ;
643643 } ) ;
644644
645645 it ( 'should adjust the era' , function ( ) {
@@ -675,10 +675,10 @@ describe('CalendarDate manipulation', function () {
675675
676676 it ( 'should constrain the day' , function ( ) {
677677 let date = new CalendarDate ( 2020 , 1 , 31 ) ;
678- expect ( date . cycle ( 'month' , 1 ) ) . toEqual ( new CalendarDate ( 2020 , 2 , 31 ) ) ;
678+ expect ( date . cycle ( 'month' , 1 ) ) . toEqual ( new CalendarDate ( 2020 , 2 , 29 ) ) ;
679679
680680 date = new CalendarDate ( 2021 , 1 , 31 ) ;
681- expect ( date . cycle ( 'month' , 1 ) ) . toEqual ( new CalendarDate ( 2021 , 2 , 31 ) ) ;
681+ expect ( date . cycle ( 'month' , 1 ) ) . toEqual ( new CalendarDate ( 2021 , 2 , 28 ) ) ;
682682 } ) ;
683683
684684 it ( 'should adjust the era' , function ( ) {
@@ -704,8 +704,8 @@ describe('CalendarDate manipulation', function () {
704704 let date = new CalendarDate ( 2020 , 9 , 3 ) ;
705705 expect ( date . cycle ( 'day' , 1 ) ) . toEqual ( new CalendarDate ( 2020 , 9 , 4 ) ) ;
706706 expect ( date . cycle ( 'day' , - 1 ) ) . toEqual ( new CalendarDate ( 2020 , 9 , 2 ) ) ;
707- expect ( date . cycle ( 'day' , 28 ) ) . toEqual ( new CalendarDate ( 2020 , 9 , 31 ) ) ;
708- expect ( date . cycle ( 'day' , - 4 ) ) . toEqual ( new CalendarDate ( 2020 , 9 , 30 ) ) ;
707+ expect ( date . cycle ( 'day' , 28 ) ) . toEqual ( new CalendarDate ( 2020 , 9 , 1 ) ) ;
708+ expect ( date . cycle ( 'day' , - 4 ) ) . toEqual ( new CalendarDate ( 2020 , 9 , 29 ) ) ;
709709 } ) ;
710710
711711 it ( 'should cycle the day with rounding' , function ( ) {
@@ -800,4 +800,4 @@ describe('ZonedDateTime manipulation', function () {
800800 expect ( date . subtract ( { [ `${ Unit } ` ] : 5 } ) ) . toEqual ( Expected ) ;
801801 } ) ;
802802 } ) ;
803- } ) ;
803+ } ) ;
0 commit comments