@@ -851,20 +851,12 @@ describe('Duration', () => {
851
851
equal ( `${ hours25 . round ( { largestUnit : 'days' , relativeTo : { year : 2019 , month : 11 , day : 2 } } ) } ` , 'P1DT1H' ) ;
852
852
} ) ;
853
853
it ( 'accepts datetime string equivalents or fields for relativeTo' , ( ) => {
854
- [ '2020-01-01' , '2020-01-01T00:00:00.000000000' , 20200101 , 20200101n , { year : 2020 , month : 1 , day : 1 } ] . forEach (
854
+ [ '2020-01-01' , '2020-01-01T00:00:00.000000000' , 20200101n , { year : 2020 , month : 1 , day : 1 } ] . forEach (
855
855
( relativeTo ) => {
856
856
equal ( `${ d . round ( { smallestUnit : 'seconds' , relativeTo } ) } ` , 'P5Y5M5W5DT5H5M5S' ) ;
857
857
}
858
858
) ;
859
859
} ) ;
860
- it ( "throws on relativeTo that can't be converted to datetime string" , ( ) => {
861
- throws ( ( ) => d . round ( { smallestUnit : 'seconds' , relativeTo : Symbol ( 'foo' ) } ) , TypeError ) ;
862
- } ) ;
863
- it ( 'throws on relativeTo that converts to an invalid datetime string' , ( ) => {
864
- [ 3.14 , true , null , 'hello' , 1n ] . forEach ( ( relativeTo ) => {
865
- throws ( ( ) => d . round ( { smallestUnit : 'seconds' , relativeTo } ) , RangeError ) ;
866
- } ) ;
867
- } ) ;
868
860
it ( 'throws on wrong offset for ZonedDateTime relativeTo string' , ( ) => {
869
861
throws (
870
862
( ) => d . round ( { smallestUnit : 'seconds' , relativeTo : '1971-01-01T00:00+02:00[Africa/Monrovia]' } ) ,
@@ -1252,7 +1244,7 @@ describe('Duration', () => {
1252
1244
equal ( s , 0.002031 ) ;
1253
1245
} ) ;
1254
1246
it ( 'accepts datetime string equivalents or fields for relativeTo' , ( ) => {
1255
- [ '2020-01-01' , '2020-01-01T00:00:00.000000000' , 20200101 , 20200101n , { year : 2020 , month : 1 , day : 1 } ] . forEach (
1247
+ [ '2020-01-01' , '2020-01-01T00:00:00.000000000' , 20200101n , { year : 2020 , month : 1 , day : 1 } ] . forEach (
1256
1248
( relativeTo ) => {
1257
1249
const daysPastJuly1 = 5 * 7 + 5 - 30 ; // 5 weeks + 5 days - 30 days in June
1258
1250
const partialDayNanos =
@@ -1270,14 +1262,6 @@ describe('Duration', () => {
1270
1262
}
1271
1263
) ;
1272
1264
} ) ;
1273
- it ( "throws on relativeTo that can't be converted to datetime string" , ( ) => {
1274
- throws ( ( ) => d . total ( { unit : 'months' , relativeTo : Symbol ( 'foo' ) } ) , TypeError ) ;
1275
- } ) ;
1276
- it ( 'throws on relativeTo that converts to an invalid datetime string' , ( ) => {
1277
- [ 3.14 , true , null , 'hello' , 1n ] . forEach ( ( relativeTo ) => {
1278
- throws ( ( ) => d . total ( { unit : 'months' , relativeTo } ) , RangeError ) ;
1279
- } ) ;
1280
- } ) ;
1281
1265
it ( 'throws on wrong offset for ZonedDateTime relativeTo string' , ( ) => {
1282
1266
throws ( ( ) => d . total ( { unit : 'months' , relativeTo : '1971-01-01T00:00+02:00[Africa/Monrovia]' } ) , RangeError ) ;
1283
1267
} ) ;
0 commit comments