Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Dates

Date helper class
日期工具类

Hierarchy

  • Dates

Index

Methods

Static getDayOfWeek

  • getDayOfWeek(d: Date, dayOfWeek: 0 | 1 | 2 | 3 | 4 | 5 | 6): Date
  • Gets the dayOfWeek based on the orient day.

    Parameters

    • d: Date

      The orient day

    • dayOfWeek: 0 | 1 | 2 | 3 | 4 | 5 | 6

      0 is Sunday; Defaults is 1.

    Returns Date

Static getDaysOfMonth

  • getDaysOfMonth(m: number, y?: number): number
  • Gets the number of days in the month and the year. Automatically corrects for LeapYear.

    Parameters

    • m: number

      The month (0-11)

    • Optional y: number

      The year or this year

    Returns number

Static getFirstDayOfMonth

  • Gets the 1st day of the month based on the orient day.

    Parameters

    • d: Date

      The orient day

    Returns Date

Static getLastDayOfMonth

  • Gets the last day of the month based on the orient day.

    Parameters

    • d: Date

      The orient day

    Returns Date

Static isLeapYear

  • isLeapYear(y: number): boolean
  • Determines if the current date instance is within a LeapYear.

    Parameters

    • y: number

      The year.

    Returns boolean

    True if date is within a LeapYear, otherwise false.

Static isValidDate

  • isValidDate(d: Date | string | number): boolean
  • Parameters

    • d: Date | string | number

    Returns boolean

Object literals

Static I18N_RESOURCE

I18N_RESOURCE: object

AM

AM: string = "AM"

MONTH_NAMES

MONTH_NAMES: string[] = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]

MONTH_SHORT_NAMES

MONTH_SHORT_NAMES: string[] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

PM

PM: string = "PM"

WEEK_DAY_NAMES

WEEK_DAY_NAMES: string[] = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]

WEEK_DAY_SHORT_NAMES

WEEK_DAY_SHORT_NAMES: string[] = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]