1
$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
$fieldset->addField(
    'to_date',
    'date',
    [
        'name' => 'to_date',
        'label' => __('From'),
        'title' => __('From'),
        'date_format' => $dateFormat,
        'class' => 'validate-date',
        'required' => false,
        'singleClick' => true
    ]
);

Date validation is not working. Please suggest.

1
  • what validation applied here? what is not working? Commented Nov 14, 2019 at 12:38

1 Answer 1

1

Please try this and check it.

$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
$fieldset->addField(
    'to_date',
    'date',
    [
        'name' => 'to_date',
        'label' => __('From'),
        'title' => __('From'),
        'date_format' => $dateFormat,
        'validation' => [
            'validate-date' => true
        ],
        'required' => false,
        'singleClick' => true
    ]
);
1
  • I have check this, but it is not working
    – Divya
    Commented Nov 14, 2019 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.