- Issue created by @kristiantosney
- Status changed to Needs review
3 months ago 10:12am 28 August 2024 - 🇫🇷France lazzyvn paris
This patch needs a lot of work
$this->smartDateElements($items, $langcode);
but methode smartDateElements has only $items without $langcode;
and errors with phpcs
395 | ERROR | [ ] Missing parameter comment
395 | ERROR | [x] Data types in @param tags need to be fully namespaced
397 | ERROR | [ ] Description for the @return value is missing
I think smartDate must have a service to get the date and end date, it must use the service if it exists - Status changed to Fixed
2 months ago 8:14pm 6 September 2024 Automatically closed - issue fixed for 2 weeks with no activity.
- 🇬🇧United Kingdom kristiantosney
It doesn't work to just have smart dates using the existing date range method as the way days are stored is different so I'd advise either using what I've added in the patch or adding something of your own rather than just trying to use the existing date range method. I've added an updated patch to work with the change you made.
- 🇫🇷France lazzyvn paris
why in your patch don't you check if value and end_date are not null?
i think it's better if you can apply the patch by checking $item->get('value') and $item->get('start_date')
something like this{ /** @var \Drupal\Core\Datetime\DrupalDateTime $start_date */ $start_date = $item->start_date ?? $item->value; /** @var \Drupal\Core\Datetime\DrupalDateTime $end_date */ $end_date = $item->end_date;