跳至主要內容

Date

小于 1 分钟featurees-standard

Date

模块

修复的 ES5 特性:

Annex B 方法模块:

类型

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;
}

入口点

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

示例

示例open in new window:

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