|
7 | 7 | ObjectCreate
|
8 | 8 | } from './primordials.mjs';
|
9 | 9 |
|
| 10 | +import { calendarImpl } from './calendar.mjs'; |
10 | 11 | import * as ES from './ecmascript.mjs';
|
11 | 12 | import { DateTimeFormat } from './intl.mjs';
|
12 | 13 | import { MakeIntrinsicClass } from './intrinsicclass.mjs';
|
@@ -71,22 +72,22 @@ export class PlainDateTime {
|
71 | 72 | get year() {
|
72 | 73 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
73 | 74 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
74 |
| - return ES.CalendarYear(GetSlot(this, CALENDAR), isoDate); |
| 75 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { year: true }).year; |
75 | 76 | }
|
76 | 77 | get month() {
|
77 | 78 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
78 | 79 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
79 |
| - return ES.CalendarMonth(GetSlot(this, CALENDAR), isoDate); |
| 80 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { month: true }).month; |
80 | 81 | }
|
81 | 82 | get monthCode() {
|
82 | 83 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
83 | 84 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
84 |
| - return ES.CalendarMonthCode(GetSlot(this, CALENDAR), isoDate); |
| 85 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { monthCode: true }).monthCode; |
85 | 86 | }
|
86 | 87 | get day() {
|
87 | 88 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
88 | 89 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
89 |
| - return ES.CalendarDay(GetSlot(this, CALENDAR), isoDate); |
| 90 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { day: true }).day; |
90 | 91 | }
|
91 | 92 | get hour() {
|
92 | 93 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
@@ -115,57 +116,57 @@ export class PlainDateTime {
|
115 | 116 | get era() {
|
116 | 117 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
117 | 118 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
118 |
| - return ES.CalendarEra(GetSlot(this, CALENDAR), isoDate); |
| 119 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { era: true }).era; |
119 | 120 | }
|
120 | 121 | get eraYear() {
|
121 | 122 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
122 | 123 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
123 |
| - return ES.CalendarEraYear(GetSlot(this, CALENDAR), isoDate); |
| 124 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { eraYear: true }).eraYear; |
124 | 125 | }
|
125 | 126 | get dayOfWeek() {
|
126 | 127 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
127 | 128 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
128 |
| - return ES.CalendarDayOfWeek(GetSlot(this, CALENDAR), isoDate); |
| 129 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { dayOfWeek: true }).dayOfWeek; |
129 | 130 | }
|
130 | 131 | get dayOfYear() {
|
131 | 132 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
132 | 133 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
133 |
| - return ES.CalendarDayOfYear(GetSlot(this, CALENDAR), isoDate); |
| 134 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { dayOfYear: true }).dayOfYear; |
134 | 135 | }
|
135 | 136 | get weekOfYear() {
|
136 | 137 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
137 | 138 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
138 |
| - return ES.CalendarWeekOfYear(GetSlot(this, CALENDAR), isoDate); |
| 139 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { weekOfYear: true }).weekOfYear.week; |
139 | 140 | }
|
140 | 141 | get yearOfWeek() {
|
141 | 142 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
142 | 143 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
143 |
| - return ES.CalendarYearOfWeek(GetSlot(this, CALENDAR), isoDate); |
| 144 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { weekOfYear: true }).weekOfYear.year; |
144 | 145 | }
|
145 | 146 | get daysInWeek() {
|
146 | 147 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
147 | 148 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
148 |
| - return ES.CalendarDaysInWeek(GetSlot(this, CALENDAR), isoDate); |
| 149 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { daysInWeek: true }).daysInWeek; |
149 | 150 | }
|
150 | 151 | get daysInYear() {
|
151 | 152 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
152 | 153 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
153 |
| - return ES.CalendarDaysInYear(GetSlot(this, CALENDAR), isoDate); |
| 154 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { daysInYear: true }).daysInYear; |
154 | 155 | }
|
155 | 156 | get daysInMonth() {
|
156 | 157 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
157 | 158 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
158 |
| - return ES.CalendarDaysInMonth(GetSlot(this, CALENDAR), isoDate); |
| 159 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { daysInMonth: true }).daysInMonth; |
159 | 160 | }
|
160 | 161 | get monthsInYear() {
|
161 | 162 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
162 | 163 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
163 |
| - return ES.CalendarMonthsInYear(GetSlot(this, CALENDAR), isoDate); |
| 164 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { monthsInYear: true }).monthsInYear; |
164 | 165 | }
|
165 | 166 | get inLeapYear() {
|
166 | 167 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
167 | 168 | const isoDate = ES.TemporalObjectToISODateRecord(this);
|
168 |
| - return ES.CalendarInLeapYear(GetSlot(this, CALENDAR), isoDate); |
| 169 | + return calendarImpl(GetSlot(this, CALENDAR)).isoToDate(isoDate, { inLeapYear: true }).inLeapYear; |
169 | 170 | }
|
170 | 171 | with(temporalDateTimeLike, options = undefined) {
|
171 | 172 | if (!ES.IsTemporalDateTime(this)) throw new TypeErrorCtor('invalid receiver');
|
|
0 commit comments