// Creating format examples on every individual date item is messy, and
// placeholders are invalid for HTML5 date and datetime, so an example
// format is appended to the title to appear in tooltips.
$extra_attributes =
[ 'title' =>
t('Date (e.g. @format)',
['@format' =>
static::
formatExample($date_format)]),
'type' =>
$element['#date_date_element'
],
];
// Adds the HTML5 date attributes.
if ($date instanceof DrupalDateTime && !
$date->
hasErrors()) { $html5_min =
clone($date);
$range =
static::
datetimeRangeYears($element['#date_year_range'
],
$date);
$html5_min->
setDate($range[0
], 1, 1
)->
setTime(0, 0, 0
);
$html5_max =
clone($date);
$html5_max->
setDate($range[1
], 12, 31
)->
setTime(23, 59, 59
);
$extra_attributes +=
[ 'min' =>
$html5_min->
format($date_format,
$format_settings),
'max' =>
$html5_max->
format($date_format,
$format_settings),
];
} $element['date'
] =
[