Class Date

An ICU4X Date object capable of containing a date for any calendar.

See the Rust documentation for Date for more information.

Constructors

Accessors

  • get dayOfMonth(): number
  • Returns the 1-indexed day in the month for this date

    See the Rust documentation for day_of_month for more information.

    Returns number

  • get dayOfYear(): number
  • Returns the 1-indexed day in the year for this date

    See the Rust documentation for day_of_year for more information.

    Returns number

  • get daysInMonth(): number
  • Returns the number of days in the month represented by this date

    See the Rust documentation for days_in_month for more information.

    Returns number

  • get daysInYear(): number
  • Returns the number of days in the year represented by this date

    See the Rust documentation for days_in_year for more information.

    Returns number

  • get era(): string
  • Returns the era for this date, or an empty string

    See the Rust documentation for era for more information.

    Additional information: 1

    Returns string

  • get eraYearOrRelatedIso(): number
  • Returns the year number in the current era for this date

    For calendars without an era, returns the related ISO year.

    See the Rust documentation for era_year_or_related_iso for more information.

    Additional information: 1, 2, 3

    Returns number

  • get ffiValue(): number
  • Returns number

  • get monthCode(): string
  • Returns the month code for this date. Typically something like "M01", "M02", but can be more complicated for lunar calendars.

    See the Rust documentation for standard_code for more information.

    Additional information: 1

    Returns string

  • get monthIsLeap(): boolean
  • Returns whether the month is a leap month.

    See the Rust documentation for is_leap for more information.

    Returns boolean

  • get monthsInYear(): number
  • Returns the number of months in the year represented by this date

    See the Rust documentation for months_in_year for more information.

    Returns number

  • get ordinalMonth(): number
  • Returns 1-indexed number of the month of this date in its year

    Note that for lunar calendars this may not lead to the same month having the same ordinal month across years; use month_code if you care about month identity.

    See the Rust documentation for month for more information.

    See the Rust documentation for ordinal for more information.

    Returns number

Methods

  • Creates a new [Date] from the given codes, which are interpreted in the given calendar system

    An empty era code will treat the year as an extended year

    See the Rust documentation for try_new_from_codes for more information.

    Parameters

    • eraCode: string
    • year: number
    • monthCode: string
    • day: number
    • calendar: Calendar

    Returns Date

  • Creates a new [Date] representing the ISO date given but in a given calendar

    See the Rust documentation for new_from_iso for more information.

    Parameters

    • year: number
    • month: number
    • day: number
    • calendar: Calendar

    Returns Date

""