Node Publish date form fields updated to use HTML5 elements. New html5 input types for date and time have been added to core. Switching to browser-supported date and time fields will remove our dependance on the core date module, and reliance on the jQuery UI datepicker.
before:
$form['author']['date'] = array(
'#type' => module_exists('date') ? 'date_popup' : 'textfield',
'#title' => t('Authored on'),
// Note #date_format only applies if date module is enabled.
'#date_format' => 'Y-m-d g:i a',
'#default_value' => !empty($node->date) ? $node->date : NULL,
'#description' => t('Leave blank to use the current time.'),
);
after:
$form['author']['date'] = array(
'#type' => 'html_datetime',
'#title' => t('Authored on'),
'#default_value' => array(
'date' => format_date($node->created, 'custom', DATE_FORMAT_DATE),
'time' => format_date($node->created, 'custom', DATE_FORMAT_TIME),
),
'#attributes' => array(
'date' => array(
'min' => '1970-01-01',
'max' => '2037-12-31',
'placeholder' => t('e.g. @date', array(
'@date' => format_date(REQUEST_TIME, 'custom', DATE_FORMAT_DATE)
)),
),
'time' => array(
'placeholder' => t('e.g. @date', array(
'@date' => format_date(REQUEST_TIME, 'custom', DATE_FORMAT_TIME)
)),
),
),
'#description' => t('Leave blank to use the current time.'),
);
Introduced in branch:
1.15.x
Introduced in version:
1.15.0
Impacts:
Module developers
Related Github Issues: