Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292508

Datetime select list uses PHP non-OOP datetime functions

$
0
0

Problem/Motivation

The DateTime selectlist widget currently used the php non-oop versions of some of the date functions - such as date_format(). That expects a PHP base DateTime Object not the Drupal version, causing warnings:

<em class="placeholder">Warning</em>: date_format() expects parameter 1 to be DateTimeInterface, object given in <em class="placeholder">Drupal\Core\Datetime\Element\Datelist::incrementRound()</em> (line <em class="placeholder">340</em> of <em class="placeholder">/home/dkrm/www/core/lib/Drupal/Core/Datetime/Element/Datelist.php</em>).

(depending on time chosen in the widget you'll get at least 4 similar warnings).

Proposed resolution

switch to the OOP versions which will just work (ie $date->format('Y') instead of date_format($date, 'Y')). Patch attached.


Viewing all articles
Browse latest Browse all 292508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>