- π³πΏNew Zealand quietone
There is now a bug report for this π Datetime iso date format timezone showing wrong time Needs work .
I wanted to use the attribute as starting value for an ajax-load-more but #text and #attr differ with regard to timezones. As I'm not in UTC this doesn't work and I had to add a custom "correct" datetime-attribute to work with.
I wonder if anyone could explain the purpose of the datetime-attribute added to the render array in buildDateWithIsoAttribute
?
protected function buildDateWithIsoAttribute(DrupalDateTime $date) {
// Create the ISO date in Universal Time.
$iso_date = $date->format("Y-m-d\TH:i:s") . 'Z';
$this->setTimeZone($date);
$build = [
'#theme' => 'time',
'#text' => $this->formatDate($date),
'#html' => FALSE,
'#attributes' => [
'datetime' => $iso_date,
],
'#cache' => [
'contexts' => [
'timezone',
],
],
];
return $build;
}
Closed: duplicate
11.0 π₯
Last updated
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
There is now a bug report for this π Datetime iso date format timezone showing wrong time Needs work .