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
29
30
31
32
33
34
35
36
37
38
39
|
// |reftest| skip -- Temporal is not supported
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindate.from
description: Getters are not called when converting a ZonedDateTime to a PlainDate.
includes: [compareArray.js]
features: [Temporal]
---*/
const actual = [];
const prototypeDescrs = Object.getOwnPropertyDescriptors(Temporal.ZonedDateTime.prototype);
const getters = ["year", "month", "monthCode", "day", "hour", "minute", "second", "millisecond", "microsecond", "nanosecond", "calendar"];
for (const property of getters) {
Object.defineProperty(Temporal.ZonedDateTime.prototype, property, {
get() {
actual.push(`get ${property}`);
const value = prototypeDescrs[property].get.call(this);
return {
toString() {
actual.push(`toString ${property}`);
return value.toString();
},
valueOf() {
actual.push(`valueOf ${property}`);
return value;
},
};
},
});
}
const arg = new Temporal.ZonedDateTime(0n, "UTC");
Temporal.PlainDate.from(arg);
assert.compareArray(actual, []);
reportCompare(0, 0);
|