mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
Temporal: Add test case for rounding Duration relative to a ZonedDateTime (#4306)
This is the test for the change in tc39/proposal-temporal#3036 and is a variation of the test from tc39/proposal-temporal#2814 .
This commit is contained in:
parent
26a396da14
commit
81df127d54
22
test/intl402/Temporal/Duration/prototype/round/rounding-with-largestunit.js
vendored
Normal file
22
test/intl402/Temporal/Duration/prototype/round/rounding-with-largestunit.js
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2024 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.round
|
||||
description: Rounding mode is taken into account when largestUnit is present.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
// Based on a test case by Adam Shaw
|
||||
|
||||
const dur = new Temporal.Duration.from(0, 0, 0, 0, /* hours = */ 13, 0, 0, 0, 0, 0);
|
||||
const zdt = new Temporal.ZonedDateTime(0n, "UTC");
|
||||
|
||||
TemporalHelpers.assertDuration(
|
||||
dur.round({
|
||||
relativeTo: zdt,
|
||||
largestUnit: 'hours',
|
||||
smallestUnit: 'hours',
|
||||
roundingIncrement: 12,
|
||||
roundingMode: 'ceil'
|
||||
}), 0, 0, 0, 0, 24, 0, 0, 0, 0, 0);
|
Loading…
x
Reference in New Issue
Block a user