Hi,
I'm using this module on several sites and I notice this: if I add a facet block based on a date value (creation date or a custom field), the facet block does not show the correct date.
Here is the problem:
- my site is set on timezone Europe/Rome (GTM + 1)
- I've a field_date that does not collect hours, minutes and seconds
- I create 2 nodes with this values: 01/04/2013 (4 january 2013) and 01/20/2013 (20 january 2013)

If I show the value I obtain the right value, I'm in Italia and I see 4/01/2013 and 20/01/2013

If I go on Devel I see that the field_date has this:
$field_date->value = 2013-01-03 23:00:00 and timezone is Europe/Berlin
So, cause I'm on Europe/Berlin, it shows me 4/01/2013, it adds "+1" to hours, it's correct.

The problem is on facet block based on that field (but the problem is also with default "creation date"): if I try to search these articles I've these values:
January 3, 2013 (1)
January 19, 2013 (1)

I think the problem is that the block does not "localize" these values by the timezone of the site (or of the user), and show the date value "raw" from db.

Any idea?

Comments

cpliakas’s picture

Title: In facet block dare are not converted to timezone » Date facets are not localized and only displayed in UTC
Status: Active » Postponed

Hi arrubiu.

First, Facet API can only work with the data passed to it by the backend, e.g. Apache Solr Search Integration, Search API, etc. Therefore Facet API cannot localize the values on it's end because the backend has to understand the localizations as well. I know that the Apache Solr Search Integration module only works with times in UTC, and I am guessing that Search API does as well.

Marking this as "postponed" since it has to be fixed in the backend first.

Thanks,
Chris

cpliakas’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev

Bumping back down to 7.x-1.x since there has been no divergence in code yet. For all intensive purposes 7.x-1.x is the latest code.

stevewayne’s picture

I'm having the same issue that arrubiu describes. I have a node with a created date timestamp of 1137979320, which resolves in UTC to Jan 23, 2006, 1:22am. This is the date and time displayed in the facet when you drill down.

But I'm in the Pacific timezone (America/Los_Angeles), which is UTC-7 or UTC-8 depending on whether it's standard or daylight savings time. So, the local date/time that is displayed for the node is Jan 22, 2006 @5:22pm. (UTC-8)

I'm using Drupal 6, apachesolr v6.x-3.0-rc1 and facetapi v6.x-3.0-beta2. This is a recent upgrade for us (upgrading our Solr installation from 1.x to 3.6.2), and the same issue was seen on the 6.x-1.x version of the apachesolr module.