summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Temporal/Calendar/prototype/dateUntil/zero-length-duration-result.js
blob: b4aa45e9792bbc9490f6b31d090c844b89965be3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: The duration from a date to itself is a zero duration (PT0S)
esid: sec-temporal.calendar.prototype.dateuntil
features: [Temporal]
---*/

const instance = new Temporal.Calendar("gregory");
const date = new Temporal.PlainDate(2001, 6, 3);

['year', 'month', 'week', 'day'].forEach((largestUnit) => {
  const result = instance.dateUntil(date, date, { largestUnit });
  assert.sameValue(result.toString(), 'PT0S');
});

reportCompare(0, 0);