Skip to main content

Date

Less than 1 minutefeaturees-standard

Date

Modules

ES5 features with fixes:

Annex B methods modules:

Types

interface Date {
  getYear(): number;
  setYear(year: number): number;
  toGMTString(): string;
  toISOString(): string;
  toJSON(): string;
  toString(): string;
  [Symbol.toPrimitive](hint: "default" | "number" | "string"): string | number;
}

interface DateConstructor {
  now(): number;
}

Entry points

core-js/es|stable|actual|full/date
core-js/es|stable|actual|full/date/to-string
core-js(-pure)/es|stable|actual|full/date/now
core-js(-pure)/es|stable|actual|full/date/get-year
core-js(-pure)/es|stable|actual|full/date/set-year
core-js(-pure)/es|stable|actual|full/date/to-gmt-string
core-js(-pure)/es|stable|actual|full/date/to-iso-string
core-js(-pure)/es|stable|actual|full/date/to-json
core-js(-pure)/es|stable|actual|full/date/to-primitive

Example

Exampleopen in new window:

new Date(NaN).toString(); // => 'Invalid Date'