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

DateTime min/max validators are not working when using costum format #190

Open
@BigMichi1

Description

@BigMichi1

given this input definition

        $this->add([
            'type' => DateTime::class,
            'name' => 'dutyDate',
            'options' => [
                'label' => 'duty date',
                'format' => 'd.m.Y H:i'
            ],
            'attributes' => [
                'min' => '01.01.2000 00:00',
                'max' => '31.12.2099 00:00',
            ]
        ]);

when you now enter '2.2.2199 12:43' it is accepted without causing the validator to fail

from what i have seen is that to the GreaterThan and LessThan validator the raw string is passed and compared with the raw string from the input definition. i suggest to fill the validator with real DateTime objects for 'value' and also 'min' and 'max'

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