summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lesieur2009-05-01 21:21:53 (GMT)
committerDavid Lesieur2009-05-01 21:21:53 (GMT)
commitb40d0b6aa36276fe88b7ced9c220085208db3124 (patch)
treeac6e925a9f6f4d7c98e29d9545b1c5eee1bc49b2
parentdc060631fe0634794dff463ba010f73d58e44583 (diff)
Fixed unwanted timezone conversion for datestamps.
-rwxr-xr-xdate_facets.module8
1 files changed, 5 insertions, 3 deletions
diff --git a/date_facets.module b/date_facets.module
index d3ac70d..5c989cb 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),