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.
When you pass field settings with at least one zero value to the DateObject::limitGranularity()
, it doesn't filter out anything, because non-strict comparison returns match for any granularity string and integer zero.
Patch follows.
Comment | File | Size | Author |
---|---|---|---|
#10 | date-1679552-10.patch | 1.59 KB | spiritcapsule |
| |||
#1 | date-1679552-1.patch | 2.03 KB | Dmitriy.trt |
Issue fork date-1679552
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
Dmitriy.trt CreditAttribution: Dmitriy.trt commentedFix and a test.
Comment #2
barami CreditAttribution: barami commentedI have same problem.
It needs to be accept.
Accepet above patch or change code using in_array function to add parameter 'strict' to TRUE.
http://php.net/manual/en/function.in-array.php
default 'strict' parameter is FALSE and it searchs on array keys too.
So, limitGranularity functions always don't remove granularity part.
Comment #3
barami CreditAttribution: barami commentedComment #4
barami CreditAttribution: barami commentedMerge test case with patch in #2.
Comment #5
barami CreditAttribution: barami commentedChange tab to spaces.
Comment #7
RoSk0Properly formatted version of the #4 patch with test separated.
Comment #9
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe year old patch in #7 to date_api.module does not apply to the latest 7.x-2.x-dev and will need a reroll.
Comment #10
spiritcapsule CreditAttribution: spiritcapsule as a volunteer commentedreroll of #7
Comment #11
rohan-sinha CreditAttribution: rohan-sinha at Srijan | A Material+ Company commentedreviewed patch on #10 , DateObject::limitGranularity() issue is resolved.
Comment #14
kunal_sahu CreditAttribution: kunal_sahu at Valuebound for Valuebound commentedHi @all,
I have tested this patch . The patch LGTM.
And this does solves the issue.
RTBC++.
Provided an MR for helping the maintainer.
Please merge.
Thanks