test262/test/built-ins/Temporal/Duration/compare/relativeto-propertybag-cale...

26 lines
955 B
JavaScript

// 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);