I have just updated from 6.x-2.0-rc6 and now my views is not filtering correctly.

I have a list of events that are filtered Content Start Date (field_event_start_date) >= now so that past events would not be displayed.

Now all my events are being displayed and when I look at the SQL statement I see:

(DATE_FORMAT(ADDTIME(STR_TO_DATE(node_data_field_event_start_date.field_event_start_date_value, '%Y-%m-%dT%T'), SEC_TO_TIME(-14400)), '%Y-%m-%d') >= '2009-01-01')
   ORDER BY node_data_field_event_start_date_field_event_start_date_value ASC

Why is the 'now' date equating to '2009-01-01'?
This view was working fine till I updated the module today and I have not changed any thing in the view it self.

Comments

james marks’s picture

I'm seeing the same thing. I'm setting a views filter so that a CCK date = now and the query ends as follows:

'%Y-%m-%dT%T'), '%Y-%m-%d') = '2009-01-01')

If I set the date to an absolute value of '2009', 'Mar' and '23' the query ends as:

'%Y-%m-%dT%T'), '%Y-%m-%d') = '2009-03-23')

Drupal 6.10
CCK 6.x-2.2
Date 6.x-2.0

arlinsandbulte’s picture

This issue has been fixed in Date 6.x-2.x-dev
See this issue #386406: After module upgrade, Views filter value "now" incorrectly outputs 2009-01-01

TheresaB-1’s picture

Status: Active » Fixed

Yep, that did it all is well now, thanks much. Any idea how long till the release version will be updated?

bcostacurta’s picture

Hello,

I installed indeed latest version of module date (precisely date-6.x-2.1)
but still have the 'now' function not working.

Ie. when configuring view and filter :

SELECT node.nid AS nid,
node.title AS node_title,
node_data_field_date.field_date_value AS node_data_field_date_field_date_value,
node_data_field_date.field_date_value2 AS node_data_field_date_field_date_value2,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_date.field_locationcck_lid AS node_data_field_date_field_locationcck_lid
FROM node node
LEFT JOIN content_type_event_type node_data_field_date ON node.vid = node_data_field_date.vid
WHERE (node.type in ('event_type'))
AND (((DATE_FORMAT(STR_TO_DATE(node_data_field_date.field_date_value, '%Y-%m-%dT%T'), '%Y-%m') <= '2009-03' AND DATE_FORMAT(STR_TO_DATE(node_data_field_date.field_date_value2, '%Y-%m-%dT%T'), '%Y-%m') >= '2009-03')) AND ((DATE_FORMAT(STR_TO_DATE(node_data_field_date.field_date_value, '%Y-%m-%dT%T'), '%Y-%m') <= '2009-03' AND DATE_FORMAT(STR_TO_DATE(node_data_field_date.field_date_value2, '%Y-%m-%dT%T'), '%Y-%m') >= '2009-03')))
ORDER BY node_data_field_date_field_date_value ASC

Bye,
Bruno

karens’s picture

First of all, you're posting in a closed issue, so you're lucky your post didn't get lost.

Second, this is *not* the same issue, this is an issue about a date that is set to '2009-01-01' which is *not* what you're reporting.

You are using 'now' with a filter that has 'month' granularity. When you use 'month' granularity, 'now' is '2009-03', which is exactly what you're seeing. If that's not what you want, fix the granularity of your filter (there is an icon that looks like a gear that controls your filter settings).

Status: Fixed » Closed (fixed)

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