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.

Comments

tim.plunkett’s picture

Status: Active » Needs review
StatusFileSize
new1.52 KB

Attached.

aspilicious’s picture

Status: Needs review » Reviewed & tested by the community

Indeed thats true... :)

Nice work Tim :)

karens’s picture

Status: Reviewed & tested by the community » Fixed

OK, committed. Thanks.

I finally had a chance to see how the git commit am worked on a patch that it actually works on :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

karens’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev
Status: Closed (fixed) » Patch (to be ported)

We need a 6.x version of this fix.

tim.plunkett’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new1.42 KB

Almost identical.

arlinsandbulte’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.