Skip to content

Commit

Permalink
remove obsoleted Temporal API
Browse files Browse the repository at this point in the history
  • Loading branch information
petamoriken committed Aug 2, 2024
1 parent 930ccf9 commit 28a37ad
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 129 deletions.
159 changes: 30 additions & 129 deletions cli/tsc/dts/lib.deno.unstable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2606,7 +2606,7 @@ declare namespace Temporal {
/**
* When the name of a unit is provided to a Temporal API as a string, it is
* usually singular, e.g. 'day' or 'hour'. But plural unit names like 'days'
* or 'hours' are aso accepted too.
* or 'hours' are also accepted.
*
* @category Temporal
* @experimental
Expand Down Expand Up @@ -2925,8 +2925,8 @@ declare namespace Temporal {
* This value must be either a `Temporal.PlainDateTime`, a
* `Temporal.ZonedDateTime`, or a string or object value that can be
* passed to `from()` of those types. Examples:
* - `'2020-01'01T00:00-08:00[America/Los_Angeles]'`
* - `'2020-01'01'`
* - `'2020-01-01T00:00-08:00[America/Los_Angeles]'`
* - `'2020-01-01'`
* - `Temporal.PlainDate.from('2020-01-01')`
*
* `Temporal.ZonedDateTime` will be tried first because it's more
Expand Down Expand Up @@ -2971,8 +2971,8 @@ declare namespace Temporal {
* This value must be either a `Temporal.PlainDateTime`, a
* `Temporal.ZonedDateTime`, or a string or object value that can be passed
* to `from()` of those types. Examples:
* - `'2020-01'01T00:00-08:00[America/Los_Angeles]'`
* - `'2020-01'01'`
* - `'2020-01-01T00:00-08:00[America/Los_Angeles]'`
* - `'2020-01-01'`
* - `Temporal.PlainDate.from('2020-01-01')`
*
* `Temporal.ZonedDateTime` will be tried first because it's more
Expand Down Expand Up @@ -3007,8 +3007,8 @@ declare namespace Temporal {
* This value must be either a `Temporal.PlainDateTime`, a
* `Temporal.ZonedDateTime`, or a string or object value that can be passed
* to `from()` of those types. Examples:
* - `'2020-01'01T00:00-08:00[America/Los_Angeles]'`
* - `'2020-01'01'`
* - `'2020-01-01T00:00-08:00[America/Los_Angeles]'`
* - `'2020-01-01'`
* - `Temporal.PlainDate.from('2020-01-01')`
*
* `Temporal.ZonedDateTime` will be tried first because it's more
Expand All @@ -3027,6 +3027,16 @@ declare namespace Temporal {
| string;
}

/**
* Options to control behaviour of `ZonedDateTime.prototype.getTimeZoneTransition()`
*
* @category Temporal
* @experimental
*/
export type TransitionDirection = "next" | "previous" | {
direction: "next" | "previous";
};

/**
* @category Temporal
* @experimental
Expand Down Expand Up @@ -3127,19 +3137,15 @@ declare namespace Temporal {
* @experimental
*/
export class Instant {
static fromEpochSeconds(epochSeconds: number): Temporal.Instant;
static fromEpochMilliseconds(epochMilliseconds: number): Temporal.Instant;
static fromEpochMicroseconds(epochMicroseconds: bigint): Temporal.Instant;
static fromEpochNanoseconds(epochNanoseconds: bigint): Temporal.Instant;
static from(item: Temporal.Instant | string): Temporal.Instant;
static compare(
one: Temporal.Instant | string,
two: Temporal.Instant | string,
): ComparisonResult;
constructor(epochNanoseconds: bigint);
readonly epochSeconds: number;
readonly epochMilliseconds: number;
readonly epochMicroseconds: bigint;
readonly epochNanoseconds: bigint;
equals(other: Temporal.Instant | string): boolean;
add(
Expand Down Expand Up @@ -3300,14 +3306,14 @@ declare namespace Temporal {
| Temporal.PlainDateTime
| PlainDateLike
| string,
): number;
): number | undefined;
yearOfWeek(
date:
| Temporal.PlainDate
| Temporal.PlainDateTime
| PlainDateLike
| string,
): number;
): number | undefined;
daysInWeek(
date:
| Temporal.PlainDate
Expand Down Expand Up @@ -3476,14 +3482,14 @@ declare namespace Temporal {
| Temporal.PlainDateTime
| PlainDateLike
| string,
): number;
): number | undefined;
yearOfWeek(
date:
| Temporal.PlainDate
| Temporal.PlainDateTime
| PlainDateLike
| string,
): number;
): number | undefined;
daysInWeek(
date:
| Temporal.PlainDate
Expand Down Expand Up @@ -3614,11 +3620,10 @@ declare namespace Temporal {
readonly monthCode: string;
readonly day: number;
readonly calendarId: string;
getCalendar(): CalendarProtocol;
readonly dayOfWeek: number;
readonly dayOfYear: number;
readonly weekOfYear: number;
readonly yearOfWeek: number;
readonly weekOfYear: number | undefined;
readonly yearOfWeek: number | undefined;
readonly daysInWeek: number;
readonly daysInYear: number;
readonly daysInMonth: number;
Expand Down Expand Up @@ -3755,11 +3760,10 @@ declare namespace Temporal {
readonly microsecond: number;
readonly nanosecond: number;
readonly calendarId: string;
getCalendar(): CalendarProtocol;
readonly dayOfWeek: number;
readonly dayOfYear: number;
readonly weekOfYear: number;
readonly yearOfWeek: number;
readonly weekOfYear: number | undefined;
readonly yearOfWeek: number | undefined;
readonly daysInWeek: number;
readonly daysInYear: number;
readonly daysInMonth: number;
Expand All @@ -3773,9 +3777,6 @@ declare namespace Temporal {
withPlainTime(
timeLike?: Temporal.PlainTime | PlainTimeLike | string,
): Temporal.PlainDateTime;
withPlainDate(
dateLike: Temporal.PlainDate | PlainDateLike | string,
): Temporal.PlainDateTime;
withCalendar(calendar: CalendarLike): Temporal.PlainDateTime;
add(
durationLike: Temporal.Duration | DurationLike | string,
Expand Down Expand Up @@ -3831,8 +3832,6 @@ declare namespace Temporal {
options?: ToInstantOptions,
): Temporal.ZonedDateTime;
toPlainDate(): Temporal.PlainDate;
toPlainYearMonth(): Temporal.PlainYearMonth;
toPlainMonthDay(): Temporal.PlainMonthDay;
toPlainTime(): Temporal.PlainTime;
getISOFields(): PlainDateTimeISOFields;
toLocaleString(
Expand Down Expand Up @@ -3883,7 +3882,6 @@ declare namespace Temporal {
readonly monthCode: string;
readonly day: number;
readonly calendarId: string;
getCalendar(): CalendarProtocol;
equals(other: Temporal.PlainMonthDay | PlainMonthDayLike | string): boolean;
with(
monthDayLike: PlainMonthDayLike,
Expand Down Expand Up @@ -4013,13 +4011,6 @@ declare namespace Temporal {
| "nanosecond"
>,
): Temporal.PlainTime;
toPlainDateTime(
temporalDate: Temporal.PlainDate | PlainDateLike | string,
): Temporal.PlainDateTime;
toZonedDateTime(timeZoneAndDate: {
timeZone: TimeZoneLike;
plainDate: Temporal.PlainDate | PlainDateLike | string;
}): Temporal.ZonedDateTime;
getISOFields(): PlainTimeISOFields;
toLocaleString(
locales?: string | string[],
Expand Down Expand Up @@ -4049,12 +4040,6 @@ declare namespace Temporal {
dateTime: Temporal.PlainDateTime | PlainDateTimeLike | string,
options?: ToInstantOptions,
): Temporal.Instant;
getNextTransition?(
startingPoint: Temporal.Instant | string,
): Temporal.Instant | null;
getPreviousTransition?(
startingPoint: Temporal.Instant | string,
): Temporal.Instant | null;
getPossibleInstantsFor(
dateTime: Temporal.PlainDateTime | PlainDateTimeLike | string,
): Temporal.Instant[];
Expand Down Expand Up @@ -4091,7 +4076,6 @@ declare namespace Temporal {
static from(timeZone: TimeZoneLike): Temporal.TimeZone | TimeZoneProtocol;
constructor(timeZoneIdentifier: string);
readonly id: string;
equals(timeZone: TimeZoneLike): boolean;
getOffsetNanosecondsFor(instant: Temporal.Instant | string): number;
getOffsetStringFor(instant: Temporal.Instant | string): string;
getPlainDateTimeFor(
Expand All @@ -4102,12 +4086,6 @@ declare namespace Temporal {
dateTime: Temporal.PlainDateTime | PlainDateTimeLike | string,
options?: ToInstantOptions,
): Temporal.Instant;
getNextTransition(
startingPoint: Temporal.Instant | string,
): Temporal.Instant | null;
getPreviousTransition(
startingPoint: Temporal.Instant | string,
): Temporal.Instant | null;
getPossibleInstantsFor(
dateTime: Temporal.PlainDateTime | PlainDateTimeLike | string,
): Temporal.Instant[];
Expand Down Expand Up @@ -4160,7 +4138,6 @@ declare namespace Temporal {
readonly month: number;
readonly monthCode: string;
readonly calendarId: string;
getCalendar(): CalendarProtocol;
readonly daysInMonth: number;
readonly daysInYear: number;
readonly monthsInYear: number;
Expand Down Expand Up @@ -4272,13 +4249,11 @@ declare namespace Temporal {
readonly microsecond: number;
readonly nanosecond: number;
readonly timeZoneId: string;
getTimeZone(): TimeZoneProtocol;
readonly calendarId: string;
getCalendar(): CalendarProtocol;
readonly dayOfWeek: number;
readonly dayOfYear: number;
readonly weekOfYear: number;
readonly yearOfWeek: number;
readonly weekOfYear: number | undefined;
readonly yearOfWeek: number | undefined;
readonly hoursInDay: number;
readonly daysInWeek: number;
readonly daysInMonth: number;
Expand All @@ -4299,9 +4274,6 @@ declare namespace Temporal {
withPlainTime(
timeLike?: Temporal.PlainTime | PlainTimeLike | string,
): Temporal.ZonedDateTime;
withPlainDate(
dateLike: Temporal.PlainDate | PlainDateLike | string,
): Temporal.ZonedDateTime;
withCalendar(calendar: CalendarLike): Temporal.ZonedDateTime;
withTimeZone(timeZone: TimeZoneLike): Temporal.ZonedDateTime;
add(
Expand Down Expand Up @@ -4354,11 +4326,12 @@ declare namespace Temporal {
>,
): Temporal.ZonedDateTime;
startOfDay(): Temporal.ZonedDateTime;
getTimeZoneTransition(
direction: TransitionDirection,
): Temporal.ZonedDateTime | null;
toInstant(): Temporal.Instant;
toPlainDateTime(): Temporal.PlainDateTime;
toPlainDate(): Temporal.PlainDate;
toPlainYearMonth(): Temporal.PlainYearMonth;
toPlainMonthDay(): Temporal.PlainMonthDay;
toPlainTime(): Temporal.PlainTime;
getISOFields(): ZonedDateTimeISOFields;
toLocaleString(
Expand Down Expand Up @@ -4395,29 +4368,6 @@ declare namespace Temporal {
*/
instant: () => Temporal.Instant;

/**
* Get the current calendar date and clock time in a specific calendar and
* time zone.
*
* The `calendar` parameter is required. When using the ISO 8601 calendar or
* if you don't understand the need for or implications of a calendar, then
* a more ergonomic alternative to this method is
* `Temporal.Now.zonedDateTimeISO()`.
*
* @param {CalendarLike} [calendar] - calendar identifier, or
* a `Temporal.Calendar` instance, or an object implementing the calendar
* protocol.
* @param {TimeZoneLike} [tzLike] -
* {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|IANA time zone identifier}
* string (e.g. `'Europe/London'`), `Temporal.TimeZone` instance, or an
* object implementing the time zone protocol. If omitted, the environment's
* current time zone will be used.
*/
zonedDateTime: (
calendar: CalendarLike,
tzLike?: TimeZoneLike,
) => Temporal.ZonedDateTime;

/**
* Get the current calendar date and clock time in a specific time zone,
* using the ISO 8601 calendar.
Expand All @@ -4430,34 +4380,6 @@ declare namespace Temporal {
*/
zonedDateTimeISO: (tzLike?: TimeZoneLike) => Temporal.ZonedDateTime;

/**
* Get the current calendar date and clock time in a specific calendar and
* time zone.
*
* The calendar is required. When using the ISO 8601 calendar or if you
* don't understand the need for or implications of a calendar, then a more
* ergonomic alternative to this method is `Temporal.Now.plainDateTimeISO`.
*
* Note that the `Temporal.PlainDateTime` type does not persist the time zone,
* but retaining the time zone is required for most time-zone-related use
* cases. Therefore, it's usually recommended to use
* `Temporal.Now.zonedDateTimeISO` or `Temporal.Now.zonedDateTime` instead
* of this function.
*
* @param {CalendarLike} [calendar] - calendar identifier, or
* a `Temporal.Calendar` instance, or an object implementing the calendar
* protocol.
* @param {TimeZoneLike} [tzLike] -
* {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|IANA time zone identifier}
* string (e.g. `'Europe/London'`), `Temporal.TimeZone` instance, or an
* object implementing the time zone protocol. If omitted,
* the environment's current time zone will be used.
*/
plainDateTime: (
calendar: CalendarLike,
tzLike?: TimeZoneLike,
) => Temporal.PlainDateTime;

/**
* Get the current date and clock time in a specific time zone, using the
* ISO 8601 calendar.
Expand All @@ -4475,27 +4397,6 @@ declare namespace Temporal {
*/
plainDateTimeISO: (tzLike?: TimeZoneLike) => Temporal.PlainDateTime;

/**
* Get the current calendar date in a specific calendar and time zone.
*
* The calendar is required. When using the ISO 8601 calendar or if you
* don't understand the need for or implications of a calendar, then a more
* ergonomic alternative to this method is `Temporal.Now.plainDateISO`.
*
* @param {CalendarLike} [calendar] - calendar identifier, or
* a `Temporal.Calendar` instance, or an object implementing the calendar
* protocol.
* @param {TimeZoneLike} [tzLike] -
* {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|IANA time zone identifier}
* string (e.g. `'Europe/London'`), `Temporal.TimeZone` instance, or an
* object implementing the time zone protocol. If omitted,
* the environment's current time zone will be used.
*/
plainDate: (
calendar: CalendarLike,
tzLike?: TimeZoneLike,
) => Temporal.PlainDate;

/**
* Get the current date in a specific time zone, using the ISO 8601
* calendar.
Expand Down
Loading

0 comments on commit 28a37ad

Please sign in to comment.