Class MonthHelper

Hierarchy

  • MonthHelper

Constructors

Properties

Methods

Constructors

Properties

ENUMS: Month[] = ...

Private cache of all the constants.

Methods

  • of(month: number): Month
  • Obtains an instance of Month from an number value.

    Month is an enum representing the 12 months of the year. This factory allows the enum to be obtained from the number value. The number value follows the ISO-8601 standard, from 1 (January) to 12 (December).

    Returns

    the month-of-year, not null

    Throws

    DateTimeException if the month-of-year is invalid

    Parameters

    • month: number

      the month-of-year to represent, from 1 (January) to 12 (December)

    Returns Month

  • Returns the month-of-year that is the specified number of months before this one.

    The calculation rolls around the start of the year from January to December. The specified period may be negative.

    This instance is immutable and unaffected by this method call.

    Returns

    the resulting month, not null

    Parameters

    • months: number

      the months to subtract, positive or negative

    • month: Month

      the Month from where the subtraction is computed

    Returns Month

  • Returns the month-of-year that is the specified number of months after this one.

    The calculation rolls around the end of the year from December to January. The specified period may be negative.

    This instance is immutable and unaffected by this method call.

    Returns

    the resulting month, not null

    Parameters

    • months: number

      the months to add, positive or negative

    • month: Month

      the Month from where the addition is computed

    Returns Month

  • valueOf(month: Month): number
  • Gets the month-of-year number value.

    The values are numbered following the ISO-8601 standard, from 1 (January) to 12 (December).

    Returns

    the month-of-year, from 1 (January) to 12 (December)

    Parameters

    Returns number

Generated using TypeDoc