summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainDateTime/prototype/since/round-relative-to-receiver.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/PlainDateTime/prototype/since/round-relative-to-receiver.js')
-rw-r--r--js/src/tests/test262/built-ins/Temporal/PlainDateTime/prototype/since/round-relative-to-receiver.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/PlainDateTime/prototype/since/round-relative-to-receiver.js b/js/src/tests/test262/built-ins/Temporal/PlainDateTime/prototype/since/round-relative-to-receiver.js
new file mode 100644
index 0000000000..af8a646eb0
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/PlainDateTime/prototype/since/round-relative-to-receiver.js
@@ -0,0 +1,27 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.plaindatetime.prototype.since
+description: Values are rounded relative to the receiver
+includes: [temporalHelpers.js]
+features: [Temporal]
+---*/
+
+const dt1 = new Temporal.PlainDateTime(2019, 1, 1);
+const dt2 = new Temporal.PlainDateTime(2020, 7, 2);
+
+TemporalHelpers.assertDuration(
+ dt2.since(dt1, { smallestUnit: "years", roundingMode: "halfExpand" }),
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ "rounds relative to the receiver (positive case)"
+);
+
+TemporalHelpers.assertDuration(
+ dt1.since(dt2, { smallestUnit: "years", roundingMode: "halfExpand" }),
+ -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ "rounds relative to the receiver (negative case)"
+);
+
+reportCompare(0, 0);