test262/test/built-ins/Temporal/Now/plainDate/toPlainDate-override.js
Philip Chimento 24def913ec Remove support for nested Temporal time zone property bags
Previously, "nested" time zone property bags were unwrapped up to one
level. That is, this object:
{
  timeZone: {
     // ...Temporal.TimeZone methods
  }
}
would not be considered to implement the TimeZone protocol, but would have
its timeZone property used instead, if it were passed to an API that
required a TimeZone protocol object.

These nested property bags are no longer supported. Discussion:
https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753

Corresponding normative PR:
https://github.com/tc39/proposal-temporal/pull/2485
2023-04-10 08:36:08 -07:00

38 lines
1.1 KiB
JavaScript

// Copyright (C) 2020 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.now.plaindate
description: PlainDateTime.toPlainDate is not observably called
includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const actual = [];
const expected = [
"get timeZone.getOffsetNanosecondsFor",
"call timeZone.getOffsetNanosecondsFor",
];
Object.defineProperty(Temporal.PlainDateTime.prototype, "toPlainDate", {
get() {
actual.push("get Temporal.PlainDateTime.prototype.toPlainDate");
return function() {
actual.push("call Temporal.PlainDateTime.prototype.toPlainDate");
};
},
});
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
getOffsetNanosecondsFor(instant) {
assert.sameValue(instant instanceof Temporal.Instant, true, "Instant");
return 86399_999_999_999;
},
});
const result = Temporal.Now.plainDate("iso8601", timeZone);
assert.notSameValue(result, undefined);
assert.sameValue(result instanceof Temporal.PlainDate, true);
assert.compareArray(actual, expected);