Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Date element formats not respected in validators. #3195

Closed
waltertamboer opened this issue Dec 10, 2012 · 2 comments
Closed

Date element formats not respected in validators. #3195

waltertamboer opened this issue Dec 10, 2012 · 2 comments
Milestone

Comments

@waltertamboer
Copy link
Contributor

The date formats of form elements are not taken into account when a form is validated. This is because the formats are hardcoded right now. For example see Zend\Form\Element\Date on line 50.

@bakura10
Copy link
Contributor

iirc this is expected behaviour as those elements are expected to map exactly how HTML5 validation works. But I don't know why @cgmartin allowed to change it in DateTime element.

@cgmartin
Copy link
Contributor

Looks like the format property was added in 0029ccd but not updated in the validator. Should be an easy PR. As for why it changed in DateTime element, no clue - I must have missed those PRs. Maybe there's a use case for changing the formats, not sure.

I'd advise users against changing the format for the HTML5 date elements, since if the format doesn't match what the browser is expecting you'll run into issues. The default date formats are there to match the HTML5 spec.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants