Closed (fixed)
Project:
Date
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Jun 2011 at 17:24 UTC
Updated:
14 May 2012 at 23:10 UTC
Jump to comment: Most recent file
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 commentedIndeed thats true... :)
Nice work Tim :)
Comment #3
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 commentedWe need a 6.x version of this fix.
Comment #6
tim.plunkettAlmost identical.
Comment #7
arlinsandbulte commentedcommitted #6
http://drupalcode.org/project/date.git/commit/f817d3d