@@ -367,6 +367,9 @@ suite('duration', function () {
367367 [ '-P55D' , [ - 1 , 'month' ] , { relativeTo : '2023-02-27T22:22:57Z' } ] ,
368368 [ '-P65D' , [ - 3 , 'month' ] , { relativeTo : '2023-02-28T22:22:57Z' } ] ,
369369 [ '-P75D' , [ - 3 , 'month' ] , { relativeTo : '2023-03-09T22:22:57Z' } ] ,
370+ [ 'P1M' , [ 1 , 'month' ] , { relativeTo : '2024-05-31T00:00:00Z' } ] ,
371+ [ '-P1M' , [ - 1 , 'month' ] , { relativeTo : '2024-05-31T00:00:00Z' } ] ,
372+ [ '-P3M' , [ - 3 , 'month' ] , { relativeTo : '2023-05-30T00:00:00Z' } ] ,
370373 [
371374 'P8M' ,
372375 [ 8 , 'month' ] ,
@@ -396,6 +399,8 @@ suite('duration', function () {
396399 } ,
397400 ] ,
398401 [ 'P1M1D' , [ 1 , 'month' ] , { relativeTo : new Date ( '2022-12-01T00:00:00Z' ) } ] ,
402+ [ 'P1M1D' , [ 2 , 'month' ] , { relativeTo : new Date ( '2023-01-31T00:00:00Z' ) } ] ,
403+ [ 'P1M30D' , [ 2 , 'month' ] , { relativeTo : new Date ( '2023-01-31T00:00:00Z' ) } ] ,
399404 [
400405 'P9M20DT25H' ,
401406 [ 9 , 'month' ] ,
@@ -478,14 +483,14 @@ suite('duration', function () {
478483 ] ,
479484 ] )
480485 for ( const [ input , [ val , unit ] , opts ] of relativeTests ) {
481- test ( `getRelativeTimeUnit(${ input } ) === [${ val } , ${ unit } ]` , ( ) => {
486+ test ( `getRelativeTimeUnit(${ input } ${ opts ? `, ${ JSON . stringify ( opts ) } ` : '' } ) === [${ val } , ${ unit } ]` , ( ) => {
482487 assert . deepEqual (
483488 getRelativeTimeUnit ( Duration . from ( input ) , opts || { relativeTo : new Date ( '2023-07-01T00:00:00' ) } ) ,
484489 [ val , unit ] ,
485490 )
486491 } )
487492 if ( opts ?. relativeTo ) continue
488- test ( `getRelativeTimeUnit(-${ input } ) === [-${ val } , ${ unit } ]` , ( ) => {
493+ test ( `getRelativeTimeUnit(-${ input } ${ opts ? `, ${ JSON . stringify ( opts ) } ` : '' } ) === [-${ val } , ${ unit } ]` , ( ) => {
489494 assert . deepEqual (
490495 getRelativeTimeUnit ( Duration . from ( `-${ input } ` ) , opts || { relativeTo : new Date ( '2023-07-01T00:00:00' ) } ) ,
491496 [ - val , unit ] ,
0 commit comments