Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Been seeing these warnings on a site that was upgraded from DP6. When I dug into the code the warnings are occurring when the function is called with an array() argument, works fine if called with a null argument. Of more concern is that it seems the this->granularity is not having members unset as required. That is regardless of setting granularity to just year,month,day this->granularity always has all fields.
Comment | File | Size | Author |
---|---|---|---|
#2 | date.api-granularity-150816.patch | 521 bytes | Louis Delacretaz |
Comments
Comment #2
Louis Delacretaz CreditAttribution: Louis Delacretaz commentedAttached is a patch that resolves both warnings and properly unsets the granularity properties
Comment #3
Gik000 CreditAttribution: Gik000 as a volunteer commentedThis patch just hides warnings, does not resolve any issue.
My problem appear when I try to use drupal_get_form or ajax to load a form in which date field is set
the message is:
I have verified that this happens because $granularity is void.
Thi value is passed to limitGranularity from the function date_default_date in date_api_elements.inc,
in which the variable $element does not have the index $element['#date_format'] filled properly (it is void) so granularity is void too.
$granularity = date_format_order($element['#date_format']);
anyway I'm trying to solve this issue, I will let you know.
Comment #4
DamienMcKennaComment #5
RoSk0Closing as duplicate of #1679552: DateObject::limitGranularity() doesn't work when passed array contains zeroes.