Members
Entry
Entry with a specific month and day (recurring annually).
Example: "New Year's Day,01/01"
ExactDateEntry
Entry with a specific year, month, and day (one-time event).
Example: "Afghanistan,08/19,1919"
ExactDateWithYearEntry
Entry for a relative date (e.g., "3rd Monday in January").
Example: "Martin Luther King Jr. Day,3MondayJan"
RelativeDateEntry
Parses a CSV file and returns an array of Entry objects.
Automatically detects the format of each line.
Methods
getAllEntries(dataDir)
Reads all .csv files in the data directory and its subdirectories.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
dataDir |
./src/data | The root data directory (default: './src/data') |
Returns:
Array of all Entry objects
getEntriesByType(entries, type)
Gets entries by type.
Parameters:
| Name | Type | Description |
|---|---|---|
entries |
Array of entries to filter | |
type |
The entry type to filter by |
Returns:
Array of entries of the specified type
getEntriesInNextDays(entries, days, fromDate)
Gets entries that occur within the next N days.
Parameters:
| Name | Type | Description |
|---|---|---|
entries |
Array of entries to filter | |
days |
Number of days to look ahead | |
fromDate |
Starting date (default: today) |
Returns:
Array of entries with their next occurrence dates
getEntriesInNextMonths(entries, months, fromDate)
Gets entries that occur within the next N months.
Parameters:
| Name | Type | Description |
|---|---|---|
entries |
Array of entries to filter | |
months |
Number of months to look ahead | |
fromDate |
Starting date (default: today) |
Returns:
Array of entries with their next occurrence dates
getEntriesInNextWeeks(entries, weeks, fromDate)
Gets entries that occur within the next N weeks.
Parameters:
| Name | Type | Description |
|---|---|---|
entries |
Array of entries to filter | |
weeks |
Number of weeks to look ahead | |
fromDate |
Starting date (default: today) |
Returns:
Array of entries with their next occurrence dates
getEntriesInNextYears(entries, years, fromDate)
Gets entries that occur within the next N years.
Parameters:
| Name | Type | Description |
|---|---|---|
entries |
Array of entries to filter | |
years |
Number of years to look ahead | |
fromDate |
Starting date (default: today) |
Returns:
Array of entries with their next occurrence dates
getEntriesOnDate(entries, date)
Gets entries that occur on a specific date.
Parameters:
| Name | Type | Description |
|---|---|---|
entries |
Array of entries to filter | |
date |
The date to check |
Returns:
Array of entries that occur on this date
getEntriesOnMonthDay(entries, month, day)
Gets entries that occur on a specific month and day (any year).
Parameters:
| Name | Type | Description |
|---|---|---|
entries |
Array of entries to filter | |
month |
Month (1-12) | |
day |
Day of month |
Returns:
Array of entries that occur on this month/day
parseCSVLine(line)
Parses a single CSV line into an Entry object.
Supports three formats:
1. "Name,MM/DD" - Exact date (recurring)
2. "Name,MM/DD,YYYY" - Exact date with year (one-time)
3. "Name,NWeekdayMonth" - Relative date (e.g., "3MondayJan")
Parameters:
| Name | Type | Description |
|---|---|---|
line |
The CSV line to parse |
Returns:
An Entry object or null if invalid