Found by audriusb in #2492011: Port Calendar module to Drupal 8

Any ideas why I need to change

$item_start_date = \DateTime::createFromFormat($storage_format, $row->{$info['query_name']});
$item_end_date = \DateTime::createFromFormat($storage_format, $row->{$info['query_name']});
in /modules/contrib/calendar/src/Plugin/views/row/Calendar.php

to

$item_start_date = \DateTime::createFromFormat('U', $row->{$info['query_name']});
$item_end_date = \DateTime::createFromFormat('U', $row->{$info['query_name']});
when working with "authored on" date field? field stores timestamp format and seems like I can't use anything else other than 'U' format ... How can I change $storage_format format?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

geertvd created an issue. See original summary.

geertvd’s picture

Status: Active » Needs review
FileSize
3.9 KB
geertvd’s picture

meramo’s picture

The patch worked for me, although still getting two identical errors on the calendar page
Notice: Undefined index: id in Drupal\views\Plugin\ViewsHandlerManager->getHandler() (line 104 of core/modules/views/src/Plugin/ViewsHandlerManager.php).
For the record, using a calendar block here

meramo’s picture

As we have the HEAD stuck for this module, some patches start to conflict, so made an improved version of this one to address another annoying issue here https://www.drupal.org/node/2789829

meramo’s picture

Wow, we have a new dev and for some reason the previous patch stopped working for the "Authored on" fields. So created a new one, tested with BOTH authored on and long field machine names, so this issue and this one are still combined in one patch as they change the same lines essentially. Again, not sure if it's the best practice but it worked.
Interdiff attached is against the original patch in #3

meramo’s picture

adriancid’s picture

I solved the problem in #4 with this patch: https://www.drupal.org/node/2837728#comment-11832592