Improve validation of start and end dates for events, contribution pages and more
There are holes in the validation of start and end dates on contribution pages.
- Create a new contribution page
- Enter a start date
- Enter an end 'time' but leave the date part empty:
- Result is a fatal DB error.
This may seem like an edge-case, but it can also happen when you are 'scrolling' down the page, and accidentally 'scroll' on the time field. This sets a time.
The same is true for event pages event 'start' and 'end' dates.
The same is true for event registration open and close dates:
The same is true for price fields, with the 'active on' and 'expire on', where setting a time without a date results in a fatal error and the endlessly spinning civi icon of doom.
And for price fields, there is currently no validation to ensure the 'expire on' is before the 'active on'.
Creating campaigns also:
I think the validation should really be in the date picker element somewhere, to ensure a date and time are both set - where we expect it.
But I also thought we could take this opportunity to standardise the validation of start and end dates in:
- Event pages (event start and end)
- Event pages (registration open/close)
- Contribution pages (start and end)
- Price fields (active on, expire on)
- Campaign (start, end dates)
I am working on this now.