Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "time/days-in-month/docs/types/index.d"

Index

Functions

Functions

Export assignment daysInMonth

  • daysInMonth(month?: string | number | Date, year?: undefined | number): number
  • Returns the number of days in a month.

    Notes

    • By default, the function returns the number of days in the current month of the current year (according to local time). To determine the number of days for a particular month and year, provide month and year arguments.
    • A month may be either a month's integer value, three letter abbreviation, or full name (case insensitive).
    • The function's return value is a generalization and does not take into account inaccuracies due to daylight savings conventions, crossing timezones, or other complications with time and dates.
    throws

    must provide a recognized month

    throws

    an integer month argument must be on the interval [1,12]

    Parameters

    • Optional month: string | number | Date

      month (or Date)

    • Optional year: undefined | number

      year

    Returns number

    days in a month

    Example

    var num = daysInMonth();
    // returns <number>

    Example

    var num = daysInMonth( 2 );
    // returns <number>

    Example

    var num = daysInMonth( 2, 2016 );
    // returns 29

    Example

    var num = daysInMonth( 2, 2017 );
    // returns 28