Class: RelativeDateEntry

RelativeDateEntry()

Entry for a relative date (e.g., "3rd Monday in January"). Example: "Martin Luther King Jr. Day,3MondayJan"

Constructor

new RelativeDateEntry()

Source:

Classes

RelativeDateEntry

Members

LAST

Sentinel occurrence value meaning "the last one in the month".
Source:

Methods

(static) getNthWeekdayOfMonth(year, month, dayOfWeek, occurrence)

Calculates the Nth occurrence of a weekday in a given month/year.
Parameters:
Name Type Description
year The year
month The month (1-12)
dayOfWeek Day of week (0-6, Sunday-Saturday)
occurrence Which occurrence (1-5), or RelativeDateEntry.LAST
Source:
Returns:
The calculated date or null if it doesn't exist

(static) parseRelativeDate(dateStr)

Parses a relative date string (e.g., "3MondayJan") into components. A leading `L` means the last occurrence in the month ("LMondayMay"), which is how holidays such as Memorial Day are actually defined.
Parameters:
Name Type Description
dateStr The date string to parse
Source:
Returns:
Object with occurrence, dayOfWeek, and month