Skip to content

Fixed date validation not accepting relative dates #4825

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 13, 2018
Merged

Fixed date validation not accepting relative dates #4825

merged 2 commits into from
Dec 13, 2018

Conversation

afraca
Copy link
Contributor

@afraca afraca commented Dec 12, 2018

The date validation does not accept any value that strtotime understands, as it does date_parse with check_date afterwards.
There was an issue for this, but was closed, although I could reproduce it.
https://github.com/laravel/docs/issues/2542

app('validator')->make(['foo' => 'yesterday'], ['foo' => ['date']])->validate()

edit: Fixed typo

The data validation does not accept _any_ value that `strtotime` understands, as it does `date_parse` with `check_date` afterwards. 
There was an issue for this, but was closed, although I could reproduce it.
https://github.com/laravel/docs/issues/2542

`app('validator')->make(['foo' => 'yesterday'], ['foo' => ['date']])->validate()`
@afraca
Copy link
Contributor Author

afraca commented Dec 13, 2018

Another option would be using 'absolute', but with timezone things I find that more confusing.

@taylorotwell taylorotwell merged commit b868120 into laravel:5.7 Dec 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants