Test overflow 'constrain' in PlainDate#{add,subtract}.

This commit is contained in:
Ms2ger 2022-01-24 11:18:21 +01:00 committed by Rick Waldron
parent a042241ed2
commit 00b9691218
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,15 @@
// 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.plaindate.prototype.add
description: Constrains with overflow constrain
includes: [temporalHelpers.js]
features: [Temporal]
---*/
const jan31 = Temporal.PlainDate.from("2020-01-31");
TemporalHelpers.assertPlainDate(jan31.add({ months: 1 }),
2020, 2, "M02", 29, "implicit");
TemporalHelpers.assertPlainDate(jan31.add({ months: 1 }, { overflow: "constrain" }),
2020, 2, "M02", 29, "explicit");

View File

@ -0,0 +1,15 @@
// 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.plaindate.prototype.subtract
description: Constrains with overflow constrain
includes: [temporalHelpers.js]
features: [Temporal]
---*/
const mar31 = Temporal.PlainDate.from("2020-03-31");
TemporalHelpers.assertPlainDate(mar31.subtract({ months: 1 }),
2020, 2, "M02", 29, "implicit");
TemporalHelpers.assertPlainDate(mar31.subtract({ months: 1 }, { overflow: "constrain" }),
2020, 2, "M02", 29, "explicit");