Skip to content

L8.15.0 - Validation for RFC3339_EXTENDED date format doesn't work #35387

@vlauciani

Description

@vlauciani
  • Laravel Framework 8.15.0
  • PHP Version: 7.4

Description:

The validation for RFC3339_EXTENDED PHP date format, doesn't work correctly.

Steps To Reproduce:

<?php
// ./routes/web.php
use Illuminate\Support\Facades\Route;
Route::get('test_date', function () {
    $array = [
        'mydate1' => '2018-01-29T20:36:01.123Z',
        'mydate2' => '2018-01-29T20:36:01.123+00:00'
    ];
    Validator::make($array, [
        'mydate1' => 'required|date_format:"' . \DateTimeInterface::RFC3339_EXTENDED . '"',
        'mydate2' => 'required|date_format:"' . \DateTimeInterface::RFC3339_EXTENDED . '"'
    ])->validate();
    return "Ok";
});

Both mydate1 and mydate2 are a valid RFC3339_EXTENDED PHP date format:

but calling the test_date route on your browser, Laravel Validation return an error on mydate1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions