mirror of
https://github.com/tc39/test262.git
synced 2025-07-06 21:54:41 +02:00
Rendering Duration with negative components
A rendered Duration that was constructed with negative componented begins with a `-`, but that's the last time a minus sign appears.
This commit is contained in:
parent
8d025ef1d6
commit
85973b35e4
11
test/built-ins/Temporal/Duration/prototype/toJSON/negative-components.js
vendored
Normal file
11
test/built-ins/Temporal/Duration/prototype/toJSON/negative-components.js
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.tojson
|
||||||
|
description: Temporal.Duration.toJSON handles negative components
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
const d = new Temporal.Duration(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
|
||||||
|
const expected = "-P1Y1M1W1DT1H1M1.001001001S";
|
||||||
|
assert.sameValue(d.toJSON(), expected, "toJSON with negative components");
|
11
test/built-ins/Temporal/Duration/prototype/toString/negative-components.js
vendored
Normal file
11
test/built-ins/Temporal/Duration/prototype/toString/negative-components.js
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-temporal.duration.prototype.tostring
|
||||||
|
description: Temporal.Duration.toString handles negative components
|
||||||
|
features: [Temporal]
|
||||||
|
---*/
|
||||||
|
const d = new Temporal.Duration(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
|
||||||
|
const expected = "-P1Y1M1W1DT1H1M1.001001001S";
|
||||||
|
assert.sameValue(d.toString(), expected, "toString with negative components");
|
Loading…
x
Reference in New Issue
Block a user