Options
All
  • Public
  • Public/Protected
  • All
Menu

Module date

Date Functions

dateDaysInMonth

  • dateDaysInMonth(month: number, year: number): number
  • name

    dateDaysInMonth

    description

    Get days in month.

    summary

    import { dateDaysInMonth } from "@corefunc/corefunc/date/days-in-month";

    since

    0.3.27

    example

    dateDaysInMonth(2, 1996); ➜ 29

    Parameters

    • month: number

      Month.

    • year: number

      Year.

    Returns number

    Days in month.

dateFormat

  • dateFormat(format?: string, date?: Date, useLocalTime?: boolean): string
  • name

    dateFormat

    description

    Format date with simple template string.

    summary

    import { dateFormat } from "@corefunc/corefunc/date/format";

    since

    0.3.23

    example

    dateFormat("{YYYY}-{MM}-{DD}T{HH}:{mm}:{ss}", new Date(), true) ➜ "2020-06-15T12:30:30"

    Parameters

    • format: string = "{YYYY}-{MM}-{DD}T{HH}:{mm}:{ss}"
    • date: Date = ...
    • useLocalTime: boolean = true

    Returns string

    Formatted date.

dateInMilliseconds

  • dateInMilliseconds(date: Date | number | string): number | typeof NaN
  • name

    dateInMilliseconds

    description

    Gets the time value in milliseconds.

    since

    0.3.19

    Parameters

    • date: Date | number | string

      If passed value is a positive integer, it returns the same value.

    Returns number | typeof NaN

    Number of milliseconds since the Unix Epoch or NaN if fails.

dateIsLeapYear

  • dateIsLeapYear(year?: number): boolean
  • name

    dateIsLeapYear

    description

    Find whether a year is a leap year

    since

    0.1.37

    example
    dateIsLeapYear(2000); // ➜ true
    
    example
    dateIsLeapYear(2001); // ➜ false
    

    Parameters

    • year: number = ...

      Year to check

    Returns boolean

    Is leap year

Generated using TypeDoc