How can I create HTML DateTime output?

When I set the type of the form element to Zend \ Form \ Element \ Date, the view helper perfectly creates the HTML for the drop-down calendar. However, when I change it to Zend \ Form \ Element \ DateTime , I do not get only the time input, but the date input will return to the text input.

What is the easiest way to get an HTML DateTime form element done beautifully?

Form Element ...

<?php

....

$this->add(array(
    'name' => 'dateTime',
    'type' => 'Zend\Form\Element\DateTime',
));

Template...

<?php

....

echo $this->formrow( $form->get('dateTime') );
+5
source share
1 answer

The calendar is only displayed because the browser supports HTML5 date entry. ZF2 does not use any of them.

According to WC3 schools , datetime is an HTML5 standard, but it doesn't seem to be widely supported.

+3

All Articles