Hi,
I'm trying to filter content in a view according to a date field - particularly, I'm trying to define a list of 'forthcoming events' and 'past events'.
I tried using the Date:Date option in the Filters section of the View, however:
a) No content appears in my 'forthcoming events' view when filtering dates for >= now, and
b) In my 'past events' view, all events appear, including those with a date >= now.
Please bear in mind that I tried using the most recent dev release, however this posed another bug:
Regardless of the date I was inserting or choosing from the jscalendar, the date 01/01/2008 was being stored.
Any help is greatly appreciated.
St.
Type of Field: Date
Widget: jscalendar
Timezone: Default
Multiple: No
Required: No
Comments
Comment #1
dugh commentedSee http://drupal.org/node/277420
Comment #2
melt19 commentedI have the same issue in Version 6.
Comment #3
melt19 commentedHere's a bit more info :) (let me know if you want this moved to http://drupal.org/node/277420 but that seemed to cover Version 5)
The query is:
SELECT node.nid AS nid,
node_data_field_event_date.field_event_date_value AS node_data_field_event_date_field_event_date_value,
node.type AS node_type,
node_data_field_event_date.field_event_date_value2 AS node_data_field_event_date_field_event_date_value2,
node_data_field_event_date.nid AS node_data_field_event_date_nid,
node.title AS node_title
FROM node node
LEFT JOIN content_type_events node_data_field_event_date ON node.vid = node_data_field_event_date.vid
WHERE (node.type in ('events')) AND (DATE_FORMAT(ADDTIME(FROM_UNIXTIME(node_data_field_event_date.field_event_date_value), SEC_TO_TIME(36000)), '%Y-%m-%d') >= '2008-07-19')
ORDER BY node_data_field_event_date_field_event_date_value ASC
However the following part of the query always returns: 1970-01-01 :
DATE_FORMAT(ADDTIME(FROM_UNIXTIME(node_data_field_event_date.field_event_date_value), SEC_TO_TIME(36000)), '%Y-%m-%d')
An example format of node_data_field_event_date.field_event_date_value: 2008-04-06T00:00:00
Let me know if you need more info.
Comment #4
Forceflow commentedI tried to to the same thing a couple of days ago, and found this:
http://drupal.org/node/283649
Sure you're using the latest dev version ?
I tried the 18th of july version and now filtering on > now actually works, though spawning some other errors:
http://drupal.org/node/284572
http://drupal.org/node/284571
Comment #5
melt19 commentedMy horrible hack work-around for this is to change the constructor's default $date_type from DATE_UNIX to DATE_ISO, resulting in line 51 of date_api_sql.inc (based on date-6.x-2.0-beta3 version):
function construct($date_type = DATE_ISO, $local_timezone = NULL) {
Comment #6
karens commentedUpgrade to the -dev version. Filtering was broken in beta3 and has since been fixed (or at least improved). Remaining errors already have issues, but if you find new ones in the latest -dev code, open an issue against -dev.
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.