[ {"name": "a plain date picker: type date, submitted under its id", "args": [{"id": "start", "label": "Start date"}], "expect": "
"}, {"name": "required, with earliest and latest as the picker's min and max", "args": [{"id": "start", "label": "Start date", "required": true, "rules": {"today": null, "timing": null, "notBefore": "2026-01-01", "notAfter": "2026-12-31"}}], "expect": "
"}, {"name": "a hint describes the input; a controlled value", "args": [{"id": "appt", "label": "Appointment date", "hint": "For example, 27 3 2026", "value": "2026-03-27"}], "expect": "
For example, 27 3 2026
"}, {"name": "empty and required with showError: Enter the date", "args": [{"id": "start", "label": "Start date", "required": true, "showError": true, "value": ""}], "expect": "

Error: Enter start date

"}, {"name": "before the earliest date with showError: the date-parts message", "args": [{"id": "start", "label": "Start date", "showError": true, "rules": {"today": null, "timing": null, "notBefore": "2026-01-01", "notAfter": null}, "value": "2025-12-31"}], "expect": "

Error: Start date must be the same as or after 1 January 2026

"}, {"name": "in the past when it must be in the future, by the caller's today", "args": [{"id": "appt", "label": "Appointment date", "showError": true, "rules": {"today": "2026-10-10", "timing": "future", "notBefore": null, "notAfter": null}, "value": "2026-10-10"}], "expect": "

Error: Appointment date must be in the future

"}, {"name": "a date that does not exist (typed where there is no picker)", "args": [{"id": "start", "label": "Start date", "showError": true, "value": "2026-02-30"}], "expect": "

Error: Start date must be a real date

"}, {"name": "an error is checked only when showError is set", "args": [{"id": "start", "label": "Start date", "required": true, "value": ""}], "expect": "
"}, {"name": "a valid date with showError shows no error", "args": [{"id": "start", "label": "Start date", "required": true, "showError": true, "defaultValue": "2026-06-15"}], "expect": "
"}, {"name": "messageLabel names the date in messages instead of the label", "args": [{"id": "dob", "label": "Date of birth", "messageLabel": "Your date of birth", "required": true, "showError": true, "value": "", "autoComplete": "bday"}], "expect": "

Error: Enter your date of birth

"}, {"name": "an error passed in wins, and is described after the hint", "args": [{"id": "start", "label": "Start date", "hint": "The first day of the course", "error": "Courses cannot start on a bank holiday", "value": "2026-12-25"}], "expect": "
The first day of the course

Error: Courses cannot start on a bank holiday

"}, {"name": "name, disabled and a class of its own", "args": [{"id": "start", "name": "startDate", "label": "Start date", "disabled": true, "className": "app-date"}], "expect": "
"}, {"name": "a malformed rule date throws even before the date is checked", "args": [{"id": "start", "label": "Start date", "rules": {"today": null, "timing": null, "notBefore": "2026-13-01", "notAfter": null}}], "expectError": "2026-13-01"}, {"name": "a timing rule without today throws", "args": [{"id": "start", "label": "Start date", "rules": {"today": null, "timing": "past", "notBefore": null, "notAfter": null}}], "expectError": "rules.today is needed"} ]