{
  "id": "days-until-election-day",
  "version": "ae11e3ba1d24",
  "status": "published",
  "name": "Days Until Election Day",
  "question": "Days until Election Day",
  "summary": "Counts the days from today, or any date you choose, to the next Election Day, with its date and day of the week.",
  "category": "days",
  "subcategory": "countdowns",
  "url": "https://www.acalculator.org/days/days-until-election-day",
  "markdown": "https://www.acalculator.org/days/days-until-election-day.md",
  "kind": "function",
  "method": "Find the first date of Election Day on or after the start date, then count the days from the start date to it.",
  "assumptions": [
    "US federal Election Day is the Tuesday after the first Monday in November, in even-numbered years (2 U.S.C. 7).",
    "Start dates from January 1, 1900 to December 31, 2400 work, because the date field accepts that range.",
    "The start date itself is not counted: from the day before, the count is 1; on the day itself, it is 0.",
    "Dates are calendar days with no time of day, so a time zone or a daylight-saving change never adds or loses a day."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "from": {
        "title": "Count from",
        "description": "The date to count from. Today, unless you change it.",
        "type": "string",
        "format": "date"
      }
    }
  },
  "outputs": {
    "days": {
      "label": "Days until Election Day",
      "description": "Whole days from the start date to the next Election Day; 0 on the day itself.",
      "format": "integer"
    },
    "date": {
      "label": "Date",
      "description": "The next date of Election Day on or after the start date.",
      "format": "date-long"
    },
    "weekday": {
      "label": "Day of the week",
      "description": "The weekday of that date.",
      "format": "text"
    },
    "weeks": {
      "label": "In weeks",
      "description": "The same number of days in weeks and days.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "from": "2026-09-29"
    },
    "outputs": {
      "days": 35,
      "date": "2026-11-03",
      "weekday": "Tuesday",
      "weeks": "5 weeks"
    },
    "text": "From September 29, 2026, there are 35 days until Election Day on Tuesday, November 3, 2026."
  },
  "examples": [
    {
      "given": {
        "from": "2026-01-01"
      },
      "expect": {
        "date": "2026-11-03",
        "days": 306
      },
      "source": "2 U.S.C. 7 and 3 U.S.C. 1; the rule written again in Python 3 (datetime); docs/progress/WP-43.md"
    },
    {
      "given": {
        "from": "2026-11-04"
      },
      "expect": {
        "date": "2028-11-07",
        "days": 734
      },
      "source": "2 U.S.C. 7 and 3 U.S.C. 1; the rule written again in Python 3 (datetime); docs/progress/WP-43.md"
    }
  ],
  "sources": [
    "2 U.S.C. 7 and 3 U.S.C. 1; the rule written again in Python 3 (datetime); docs/progress/WP-43.md"
  ],
  "related": [
    "days-until-veterans-day",
    "days-until-thanksgiving",
    "days-until-black-friday",
    "days-until-winter",
    "days-until-christmas-eve",
    "days-between-dates"
  ],
  "changelog": []
}
