1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2023 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.duration.compare
description: >
Builtin dateFromFields method is not observably called when the property bag
has a string-valued calendar property
includes: [temporalHelpers.js]
features: [Temporal]
---*/
const dateFromFieldsOriginal = Object.getOwnPropertyDescriptor(Temporal.Calendar.prototype, "dateFromFields");
Object.defineProperty(Temporal.Calendar.prototype, "dateFromFields", {
configurable: true,
enumerable: false,
get() {
TemporalHelpers.assertUnreachable("dateFromFields should not be looked up");
},
});
const relativeTo = { year: 2000, month: 5, day: 2, calendar: "iso8601" };
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo });
Object.defineProperty(Temporal.Calendar.prototype, "dateFromFields", dateFromFieldsOriginal);
reportCompare(0, 0);
|