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 commentedFix and a test.
Comment #2
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 commentedComment #4
barami commentedMerge test case with patch in #2.
Comment #5
barami commentedChange tab to spaces.
Comment #7
rosk0Properly formatted version of the #4 patch with test separated.
Comment #9
chris matthews 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 commentedreroll of #7
Comment #11
rohan-sinha commentedreviewed patch on #10 , DateObject::limitGranularity() issue is resolved.
Comment #14
kunal_sahu 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