Skip to content

StartEndDate Plugin

Ensures a start date field is on or before an end date field. Automatically cross-revalidates both fields when either changes.

Options

OptionTypeDescription
formatstringDate format string. Supported tokens: YYYY, MM, DD. Separator: - or /.
startDate.fieldstringName of the start date field
startDate.messagestringError message shown on the start field when start > end
endDate.fieldstringName of the end date field
endDate.messagestringError message shown on the end field when end < start

Supported formats

FormatExample
YYYY-MM-DD2025-12-31
DD/MM/YYYY31/12/2025
MM/DD/YYYY12/31/2025
YYYY/MM/DD2025/12/31

Playground

Notes

  • Cross-revalidation is automatic: when either field changes and validates, the other is revalidated immediately.
  • If either field is empty, the constraint is not applied (defers to notEmpty or date validators).
  • Invalid calendar dates (e.g. February 30) are treated as unparseable — the cross-field constraint is skipped.
  • Equal dates are valid (inclusive comparison: start ≤ end).
  • Multiple StartEndDate instances on the same form are supported (each instance has a unique internal key).

Released under the MIT License.