I have a node type with a date field, year-only. I have created a bunch of nodes with different values in that field.
Now I have created a simple view that basically just lists those nodes and added a context filter on the date field. Here's where it gets interesting. When I now pass "2012" as a parameter to the view, both in preview and the actual page, I get no results. Views prints the following query:
SELECT node.nid AS nid, node.title AS node_title, field_data_field_veroeffentlichung_datum.field_veroeffentlichung_datum_value AS field_data_field_veroeffentlichung_datum_field_veroeffentlic, field_data_field_veroeffentlichung_autoren.field_veroeffentlichung_autoren_target_id AS field_data_field_veroeffentlichung_autoren_field_veroeffentl, 'node' AS field_data_field_veroeffentlichung_autoren_node_entity_type, 'node' AS field_data_field_veroeffentlichung_quelle_node_entity_type, 'node' AS field_data_field_veroeffentlichung_datum_node_entity_type
FROM
{node} node
LEFT JOIN {field_data_field_veroeffentlichung_datum} field_data_field_veroeffentlichung_datum ON node.nid = field_data_field_veroeffentlichung_datum.entity_id AND (field_data_field_veroeffentlichung_datum.entity_type = 'node' AND field_data_field_veroeffentlichung_datum.deleted = '0')
LEFT JOIN {field_data_field_veroeffentlichung_autoren} field_data_field_veroeffentlichung_autoren ON node.nid = field_data_field_veroeffentlichung_autoren.entity_id AND (field_data_field_veroeffentlichung_autoren.entity_type = 'node' AND field_data_field_veroeffentlichung_autoren.deleted = '0')
WHERE (( (DATE_FORMAT(FROM_UNIXTIME(field_data_field_veroeffentlichung_datum.field_veroeffentlichung_datum_value), '%Y') >= '2012' AND DATE_FORMAT(FROM_UNIXTIME(field_data_field_veroeffentlichung_datum.field_veroeffentlichung_datum_value), '%Y') <= '2012') )AND(( (node.status = '1') AND (node.type IN ('veroeffentlichung')) )))
ORDER BY field_data_field_veroeffentlichung_datum_field_veroeffentlic DESC, field_data_field_veroeffentlichung_autoren_field_veroeffentl ASC, node_title ASC
LIMIT 10 OFFSET 0
If I throw that query directly at the DB, I get 11 results, all the nodes I created for 2012.
Now if I change the parameter value to 2011, the view shows the results for 2012, despite the query actually saying '2011' in the WHERE-clause.
Comments
Comment #1
StoraH CreditAttribution: StoraH commentedThis seems to be related to this thread http://drupal.org/node/1885270#comment-6959632
What time zone are you in? If you set it to Europe/London +0000 dose it work then?
Comment #2
marcoliverI'm in Europe/Berlin +0100. Changed the timezone to +0000, and indeed my content saved with a date value of "2012" is now shown as having a date of "2011".
Closing this issue, watching the other one.