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.

Element\DateTime construction w/ invalid min / max validation values causes form to not work w/o a clear reason why #158

Closed
@jackdpeterson

Description

@jackdpeterson

Given the following array notation, the DateTime Element will indicate that the date information provided on submission is invalid. The cause for this is because the Element is presuming that the min / max validators will ALWAYS construct to a \DateTime object; however, in this case they return to null because the format is not compliant with the expected constant's string.

[
    'spec' => [
        'name' => 'start_time',
        'type' => Zend\Form\Element\DateTime::class,
        'options' => [
            'label' => 'Appointment Date',
        ],
        'attributes' => [
            'min' => '2017-01-01',
            'max' => '2017-12-29',
            'step' => 1,
        ],
    ],
]

The following spec does work:

[
    'spec' => [
        'name' => 'start_time',
        'type' => Zend\Form\Element\DateTime::class,
        'options' => [
            'label' => 'Appointment Date',
        ],
        'attributes' => [
            'min' => '2017-01-01T00:00+00:00',
            'max' => '2017-12-29T23:59+00:00',
            'step' => 1,
        ],
    ],
]

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