diff --git a/date_facets.module b/date_facets.module index d3ac70df299987372b7445e2a3884d8e2cd8e712..5c989cbbbf2bab010beb79fd656bbb3a9dd38fb0 100755 --- a/date_facets.module +++ b/date_facets.module @@ -10,6 +10,7 @@ module_load_include('inc', 'cck_facets'); // TODO: Support 'todate' column. // TODO: Timezone handling. +// TODO: Support for CCK Date granularity. /** * Implementation of hook_cck_facets_collect(). @@ -73,9 +74,10 @@ function date_facets_cck_facets_collect(&$facets, $field, $domain, $env, $arg = // Iterate through the field's multiple values. foreach ($arg->{$field['field_name']} as $item) { $timestamp = array_shift($item); // Take the item's main column. - $year = gmdate('Y', $timestamp); - $month = gmdate('n', $timestamp); - $day = gmdate('j', $timestamp); + $date = date_make_date($timestamp, $field['timezone_db'], $field['type'], $field['granularity']); + $year = date_format_date($date, 'custom', 'Y'); + $month = date_format_date($date, 'custom', 'n'); + $day = date_format_date($date, 'custom', 'j'); $active_path = array( new datestamp_facet_category($field, $year, NULL, NULL),