Skip to content

Commit 2de101d

Browse files
committed
Normative: Remove getCalendar/getTimeZone methods
Calendars and time zones will be only strings, not objects. Therefore these methods that return the calendar or time zone as an object are not needed. See: #2826
1 parent b7e4b36 commit 2de101d

16 files changed

+0
-144
lines changed

docs/plaindate.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -813,13 +813,6 @@ date.toPlainYearMonth(); // => 2006-08
813813
date.toPlainMonthDay(); // => 08-24
814814
```
815815

816-
### date.**getCalendar**(): object
817-
818-
**Returns:** a `Temporal.Calendar` instance or plain object representing the calendar in which `date` is reckoned.
819-
820-
This method is mainly useful if you need an object on which to call calendar methods.
821-
Most code will not need to use it.
822-
823816
### date.**getISOFields**(): { isoYear: number, isoMonth: number, isoDay: number, calendar: string | object }
824817

825818
**Returns:** a plain object with properties expressing `date` in the ISO 8601 calendar, as well as the calendar (usually a string, but may be an object) in which `date` is reckoned.

docs/plaindatetime.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,13 +1005,6 @@ dt.toPlainDate().toPlainYearMonth(); // => 1995-12
10051005
dt.toPlainDate().toPlainMonthDay(); // => 12-07
10061006
```
10071007

1008-
### datetime.**getCalendar**(): object
1009-
1010-
**Returns:** a `Temporal.Calendar` instance or plain object representing the calendar in which `datetime` is reckoned.
1011-
1012-
This method is mainly useful if you need an object on which to call calendar methods.
1013-
Most code will not need to use it.
1014-
10151008
### datetime.**getISOFields**(): { isoYear: number, isoMonth: number, isoDay: number, isoHour: number, isoMinute: number, isoSecond: number, isoMillisecond: number, isoMicrosecond: number, isoNanosecond: number, calendar: string | object }
10161009

10171010
**Returns:** a plain object with properties expressing `datetime` in the ISO 8601 calendar, as well as the calendar (usually a string, but may be an object) in which `datetime` is reckoned.

docs/plainmonthday.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -390,13 +390,6 @@ md = Temporal.PlainMonthDay.from({
390390
date = md.toPlainDate({ era: 'reiwa', eraYear: 2 }); // => 2020-01-01[u-ca=japanese]
391391
```
392392

393-
### monthDay.**getCalendar**(): object
394-
395-
**Returns:** a `Temporal.Calendar` instance or plain object representing the calendar in which `monthDay` is reckoned.
396-
397-
This method is mainly useful if you need an object on which to call calendar methods.
398-
Most code will not need to use it.
399-
400393
### monthDay.**getISOFields**(): { isoYear: number, isoMonth: number, isoDay: number, calendar: string | object }
401394

402395
**Returns:** a plain object with properties expressing `monthDay` in the ISO 8601 calendar, as well as the calendar (usually a string, but may be an object) in which `monthDay` is reckoned.

docs/plainyearmonth.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -642,13 +642,6 @@ ym = Temporal.PlainYearMonth.from('2019-06');
642642
ym.toPlainDate({ day: 24 }); // => 2019-06-24
643643
```
644644

645-
### yearMonth.**getCalendar**(): object
646-
647-
**Returns:** a `Temporal.Calendar` instance or plain object representing the calendar in which `yearMonth` is reckoned.
648-
649-
This method is mainly useful if you need an object on which to call calendar methods.
650-
Most code will not need to use it.
651-
652645
### yearMonth.**getISOFields**(): { isoYear: number, isoMonth: number, isoDay: number, calendar: string | object }
653646

654647
**Returns:** a plain object with properties expressing `yearMonth` in the ISO 8601 calendar, as well as the calendar (usually a string, but may be an object) that `yearMonth` is reckoned in.

docs/zoneddatetime.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,20 +1410,6 @@ zdt.toPlainDate().toPlainYearMonth(); // => 1995-12
14101410
zdt.toPlainDate().toPlainMonthDay(); // => 12-07
14111411
```
14121412

1413-
### zonedDateTime.**getCalendar**(): object
1414-
1415-
**Returns:** a `Temporal.Calendar` instance or plain object representing the calendar in which `zonedDateTime` is reckoned.
1416-
1417-
This method is mainly useful if you need an object on which to call calendar methods.
1418-
Most code will not need to use it.
1419-
1420-
### zonedDateTime.**getTimeZone**(): object
1421-
1422-
**Returns:** a `Temporal.TimeZone` instance or plain object representing the time zone in which `zonedDateTime` is reckoned.
1423-
1424-
This method is mainly useful if you need an object on which to call time zone methods.
1425-
Most code will not need to use it.
1426-
14271413
### zonedDateTime.**getISOFields**(): { isoYear: number, isoMonth: number, isoDay: number, hour: number, minute: number, second: number, millisecond: number, microsecond: number, nanosecond: number, offset: string, timeZone: string | object, calendar: string | object }
14281414

14291415
**Returns:** a plain object with properties expressing `zonedDateTime` in the ISO 8601 calendar, including all date/time fields as well as the `offset` property, and the calendar and time zone (which are usually strings, but may be objects) in which `zonedDateTime` is reckoned.

polyfill/index.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,6 @@ export namespace Temporal {
812812
readonly monthCode: string;
813813
readonly day: number;
814814
readonly calendarId: string;
815-
getCalendar(): CalendarProtocol;
816815
readonly dayOfWeek: number;
817816
readonly dayOfYear: number;
818817
readonly weekOfYear: number | undefined;
@@ -928,7 +927,6 @@ export namespace Temporal {
928927
readonly microsecond: number;
929928
readonly nanosecond: number;
930929
readonly calendarId: string;
931-
getCalendar(): CalendarProtocol;
932930
readonly dayOfWeek: number;
933931
readonly dayOfYear: number;
934932
readonly weekOfYear: number | undefined;
@@ -999,7 +997,6 @@ export namespace Temporal {
999997
readonly monthCode: string;
1000998
readonly day: number;
1001999
readonly calendarId: string;
1002-
getCalendar(): CalendarProtocol;
10031000
equals(other: Temporal.PlainMonthDay | PlainMonthDayLike | string): boolean;
10041001
with(monthDayLike: PlainMonthDayLike, options?: AssignmentOptions): Temporal.PlainMonthDay;
10051002
toPlainDate(year: { year: number }): Temporal.PlainDate;
@@ -1173,7 +1170,6 @@ export namespace Temporal {
11731170
readonly month: number;
11741171
readonly monthCode: string;
11751172
readonly calendarId: string;
1176-
getCalendar(): CalendarProtocol;
11771173
readonly daysInMonth: number;
11781174
readonly daysInYear: number;
11791175
readonly monthsInYear: number;
@@ -1258,9 +1254,7 @@ export namespace Temporal {
12581254
readonly microsecond: number;
12591255
readonly nanosecond: number;
12601256
readonly timeZoneId: string;
1261-
getTimeZone(): TimeZoneProtocol;
12621257
readonly calendarId: string;
1263-
getCalendar(): CalendarProtocol;
12641258
readonly dayOfWeek: number;
12651259
readonly dayOfYear: number;
12661260
readonly weekOfYear: number | undefined;

polyfill/lib/plaindate.mjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,6 @@ export class PlainDate {
243243
isoYear: GetSlot(this, ISO_YEAR)
244244
};
245245
}
246-
getCalendar() {
247-
if (!ES.IsTemporalDate(this)) throw new TypeError('invalid receiver');
248-
return ES.ToTemporalCalendarObject(GetSlot(this, CALENDAR));
249-
}
250246

251247
static from(item, options = undefined) {
252248
options = ES.GetOptionsObject(options);

polyfill/lib/plaindatetime.mjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,6 @@ export class PlainDateTime {
398398
isoYear: GetSlot(this, ISO_YEAR)
399399
};
400400
}
401-
getCalendar() {
402-
if (!ES.IsTemporalDateTime(this)) throw new TypeError('invalid receiver');
403-
return ES.ToTemporalCalendarObject(GetSlot(this, CALENDAR));
404-
}
405401

406402
static from(item, options = undefined) {
407403
options = ES.GetOptionsObject(options);

polyfill/lib/plainmonthday.mjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,6 @@ export class PlainMonthDay {
108108
isoYear: GetSlot(this, ISO_YEAR)
109109
};
110110
}
111-
getCalendar() {
112-
if (!ES.IsTemporalMonthDay(this)) throw new TypeError('invalid receiver');
113-
return ES.ToTemporalCalendarObject(GetSlot(this, CALENDAR));
114-
}
115111

116112
static from(item, options = undefined) {
117113
options = ES.GetOptionsObject(options);

polyfill/lib/plainyearmonth.mjs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ export class PlainYearMonth {
148148
isoYear: GetSlot(this, ISO_YEAR)
149149
};
150150
}
151-
getCalendar() {
152-
if (!ES.IsTemporalYearMonth(this)) throw new TypeError('invalid receiver');
153-
return ES.ToTemporalCalendarObject(GetSlot(this, CALENDAR));
154-
}
155151

156152
static from(item, options = undefined) {
157153
options = ES.GetOptionsObject(options);

0 commit comments

Comments
 (0)