In date.module, date_field_all_day() does following:
$granularity = $field['settings']['granularity'];
$granularity = array_pop($granularity);
When the granularity is properly ordered greatest to smallest, this works fine.
However, when exporting a field using Features, all associated arrays of settings are ksort()-ed, so (year, month, day, hour, minute, second)
becomes (day, hour, minute, month, second, year)
, and the granularity is returned as year instead of second.
In debugging this, I came across the date_granularity_sorted()
and date_granularity_precision()
functions. The latter didn't work, as it called clone() on an array. But some tweaking, and the issue is fixed, and the code is much clearer.
Comment | File | Size | Author |
---|---|---|---|
#6 | date-1192020-6.patch | 1.42 KB | tim.plunkett |
#1 | date-1192020-1.patch | 1.52 KB | tim.plunkett |
Comments
Comment #1
tim.plunkettAttached.
Comment #2
aspilicious CreditAttribution: aspilicious commentedIndeed thats true... :)
Nice work Tim :)
Comment #3
KarenS CreditAttribution: KarenS commentedOK, committed. Thanks.
I finally had a chance to see how the git commit am worked on a patch that it actually works on :)
Comment #5
KarenS CreditAttribution: KarenS commentedWe need a 6.x version of this fix.
Comment #6
tim.plunkettAlmost identical.
Comment #7
arlinsandbulte CreditAttribution: arlinsandbulte commentedcommitted #6
http://drupalcode.org/project/date.git/commit/f817d3d