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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// 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.calendar.prototype.dateadd
description: Properties on an object passed to dateAdd() are accessed in the correct order
includes: [compareArray.js, temporalHelpers.js]
features: [Temporal]
---*/
const expected = [
// ToTemporalDate → GetTemporalCalendarSlotValueWithISODefault
"get date.calendar",
"has date.calendar.dateAdd",
"has date.calendar.dateFromFields",
"has date.calendar.dateUntil",
"has date.calendar.day",
"has date.calendar.dayOfWeek",
"has date.calendar.dayOfYear",
"has date.calendar.daysInMonth",
"has date.calendar.daysInWeek",
"has date.calendar.daysInYear",
"has date.calendar.fields",
"has date.calendar.id",
"has date.calendar.inLeapYear",
"has date.calendar.mergeFields",
"has date.calendar.month",
"has date.calendar.monthCode",
"has date.calendar.monthDayFromFields",
"has date.calendar.monthsInYear",
"has date.calendar.weekOfYear",
"has date.calendar.year",
"has date.calendar.yearMonthFromFields",
"has date.calendar.yearOfWeek",
// lookup
"get date.calendar.dateFromFields",
"get date.calendar.fields",
// ToTemporalDate → CalendarFields
"call date.calendar.fields",
// ToTemporalDate → PrepareTemporalFields
"get date.day",
"get date.day.valueOf",
"call date.day.valueOf",
"get date.month",
"get date.month.valueOf",
"call date.month.valueOf",
"get date.monthCode",
"get date.monthCode.toString",
"call date.monthCode.toString",
"get date.year",
"get date.year.valueOf",
"call date.year.valueOf",
// ToTemporalDate → CalendarDateFromFields
"call date.calendar.dateFromFields",
// ToTemporalDuration
"get duration.days",
"get duration.days.valueOf",
"call duration.days.valueOf",
"get duration.hours",
"get duration.hours.valueOf",
"call duration.hours.valueOf",
"get duration.microseconds",
"get duration.microseconds.valueOf",
"call duration.microseconds.valueOf",
"get duration.milliseconds",
"get duration.milliseconds.valueOf",
"call duration.milliseconds.valueOf",
"get duration.minutes",
"get duration.minutes.valueOf",
"call duration.minutes.valueOf",
"get duration.months",
"get duration.months.valueOf",
"call duration.months.valueOf",
"get duration.nanoseconds",
"get duration.nanoseconds.valueOf",
"call duration.nanoseconds.valueOf",
"get duration.seconds",
"get duration.seconds.valueOf",
"call duration.seconds.valueOf",
"get duration.weeks",
"get duration.weeks.valueOf",
"call duration.weeks.valueOf",
"get duration.years",
"get duration.years.valueOf",
"call duration.years.valueOf",
// ToTemporalOverflow
"get options.overflow",
"get options.overflow.toString",
"call options.overflow.toString",
];
const actual = [];
const instance = new Temporal.Calendar("iso8601");
const date = TemporalHelpers.propertyBagObserver(actual, {
year: 2000,
month: 5,
monthCode: "M05",
day: 2,
calendar: TemporalHelpers.calendarObserver(actual, "date.calendar"),
}, "date");
const duration = TemporalHelpers.propertyBagObserver(actual, {
years: 1,
months: 2,
weeks: 3,
days: 4,
hours: 5,
minutes: 6,
seconds: 7,
milliseconds: 8,
microseconds: 9,
nanoseconds: 10,
}, "duration");
const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "constrain" }, "options");
instance.dateAdd(date, duration, options);
assert.compareArray(actual, expected, "order of operations");
reportCompare(0, 0);
|