Converts a Date to YYYY-MM-DD format using local date components. Avoids toISOString() which can display the wrong calendar date in some time zones.

  • Parameters

    • date: null | Date

      The date to format.

    Returns string

    Date string in YYYY-MM-DD format for use in date input value.