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

32 lines
976 B
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.zoneddatetime
description: Observable interactions with the provided timezone-like object
includes: [compareArray.js, temporalHelpers.js]
features: [BigInt, Proxy, Temporal]
---*/
const actual = [];
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
getOffsetNanosecondsFor(instant) {
assert.sameValue(
instant instanceof Temporal.Instant,
true,
'The result of evaluating (instant instanceof Temporal.Instant) is expected to be true'
);
return -Number(instant.epochNanoseconds % 86400000000000n);
}
});
Object.defineProperty(Temporal.TimeZone, 'from', {
get() {
actual.push('get Temporal.TimeZone.from');
return undefined;
}
});
Temporal.Now.zonedDateTimeISO(timeZone);
assert.compareArray(actual, [], 'no observable operations should be invoked');