I'm working a on website project which includes a web form which asks for various personal details, one of the fields on the form is Date of Birth.
The form is being validated by a custom plugin which is using models for validation.
Currently the AttributeType for the Date Of Birth field is defined as
AttributeType::DateTime, so bad values just get removed during POST, however it would be nice to try and catch values that fail a date format validation of
dd/MM/yyyy so the user can correct it, otherwise the field value will simply be discarded and user will be unaware of this.
What is best way to check and catch that the Date Of Birth field value isn't in the required format? I want avoid any regex related parsing as I'm sure there are better ways to examine the format using other PHP date related functions.