Dates - 18F/charlie GitHub Wiki

Charlie developer documentation > Dates

The dates utility is meant to provide date parsing and formatting functionality. It exists primarily as a placeholder for when Moment.js is removed and replaced with the Temporal API. For now, it only provides a single method.

function getNextElectionDay() : Object

Gets the next federal Election Day date from the current date. Federal Election Day is defined as the first Tuesday after the first Monday of November in even-numbered years.

Returns

A moment object representing the next federal Election Day at midnight UTC.

function getNextHoliday(String timesone) : Object

Gets the next holiday after the current date.

Arguments Description
timezone The timezone to use for fetching the next holiday.

Default: America/New_York, US Eastern timezone

Returns

  • An object representing the next holiday:
{
  "name": "holiday official name",
  "alsoObservedAs": "common name if different, or undefined",
  "date": "moment object representing the date of the holiday in the requested timezone"
}
⚠️ **GitHub.com Fallback** ⚠️