Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Validator] Format datetime values in comparison constraints withdateFormat option#39857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
f019cc3 to64f3fc5CompareUh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Validator/Constraints/AbstractComparison.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
64f3fc5 to9395d1dCompare56fe8dd to3873d69CompareUh oh!
There was an error while loading.Please reload this page.
fancyweb commentedApr 7, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I have three concerns with the proposed solution:
I tried to resolve this issue at least 3 times but never came out with something good enough to me. I think the difficulty is that the formatting logic is internal to |
ro0NL commentedApr 26, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
i'd be generally curious if we can move formatting to the translation level using ICU formats. eg. to avoid duplicating the message, perhaps a special translation key solely for date values. |
JohJohan commentedApr 26, 2021
That could be a solution the default value should be full date format as that is how it is now |
3873d69 to62a7952Compare62a7952 to478b8ecCompareYaFou commentedJun 26, 2021
I'm facing the issue where the tests do not provide the intl extension and tests break... I don't know what is the right way to fix it. |
dateFormat optionlouismariegaborit commentedMay 24, 2022
I'm very interesting about this feature. What is missing for the PR will be merged ? |
fabpot commentedJul 23, 2022
Closing for the reasons explained by@fancyweb |
Uh oh!
There was an error while loading.Please reload this page.
I have introduced a new option for comparison constraints called
dateFormat. This option gives the ability to use a different format for datetime values in the following placeholders:{{ value }}and{{ compared_value }}.Before:
will output:
This value should be greater than Jan 1, 2020, 12:00 AM.After:
will output:
This value should be greater than 2020-01-01.