Skip to content
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

[5.5] Fixed date comparison validators failing when a format is specified #20940

Merged
merged 4 commits into from
Sep 5, 2017

Commits on Aug 27, 2017

  1. Fixed Validator failing on 'before_or_equal:today' when the input is …

    …today's date and a format is specified
    
    The issue was that the time part was bleeding through from the current timestamp in `DateTime::createFromFormat`.
    Test case:
    * Validation rule: 'birth_date' => ['required', 'date_format:Y-m-d', 'before_or_equal:today']
    * '2017-08-27' was parsed as '2017-08-27 22:41:37'.
    * 'today' was parsed as '2017-08-27 00:00:00'.
    * Validation failed.
    pantherdd committed Aug 27, 2017
    Configuration menu
    Copy the full SHA
    1b651e6 View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2017

  1. Added date validator tests for time fields

    This shows that the fix in 1b651e6 is not going to break applications, people can still use the time part.
    This should address the comment of @taylorotwell at laravel#20789 .
    pantherdd committed Aug 29, 2017
    Configuration menu
    Copy the full SHA
    6fa579e View commit details
    Browse the repository at this point in the history

Commits on Sep 2, 2017

  1. Configuration menu
    Copy the full SHA
    574f6d3 View commit details
    Browse the repository at this point in the history
  2. Fixed Validator failing on 'date_equals' when a format is specified

    Also added a number of test cases.
    The issue was that `===` always returns false for the two separate DateTime instances returned by `getDateTimeWithOptionalFormat`.
    pantherdd committed Sep 2, 2017
    Configuration menu
    Copy the full SHA
    706d12e View commit details
    Browse the repository at this point in the history