relativeto-month.js (825B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2022 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-temporal.duration.compare 7 description: relativeTo with months. 8 features: [Temporal] 9 ---*/ 10 11 const oneMonth = new Temporal.Duration(0, 1); 12 const days30 = new Temporal.Duration(0, 0, 0, 30); 13 assert.sameValue( 14 Temporal.Duration.compare(oneMonth, days30, { relativeTo: Temporal.PlainDate.from("2018-04-01") }), 0); 15 assert.sameValue( 16 Temporal.Duration.compare(oneMonth, days30, { relativeTo: Temporal.PlainDate.from("2018-03-01") }), 1); 17 assert.sameValue( 18 Temporal.Duration.compare(oneMonth, days30, { relativeTo: Temporal.PlainDate.from("2018-02-01") }), -1); 19 20 reportCompare(0, 0);