Closed (fixed)
Project:
Date
Version:
6.x-2.0-beta3
Component:
Date Timezone
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 May 2008 at 06:21 UTC
Updated:
28 Jul 2008 at 19:21 UTC
I don't know if this is a problem with me, views2, or date, and I can't tell if it's similar to drupal.org/node/233805.
When I create a views argument for a timedate field, and tell it to use the argument @P100Y, it generates this SQL - I think the FROM_UNIXTIME calls should be dropped to get the right result.
SELECT node.nid AS nid
FROM node node
LEFT JOIN content_type_eventfordisplay node_data_field_eventdate ON node.vid = node_data_field_eventdate.vid
WHERE (node.type in ('eventfordisplay')) AND ((FROM_UNIXTIME(node_data_field_eventdate.field_eventdate_value) + INTERVAL -18000 SECOND)>='2008-05-23 00:00:00') AND ((FROM_UNIXTIME(node_data_field_eventdate.field_eventdate_value) + INTERVAL -18000 SECOND)<='2108-05-23 00:00:00')
I'm attaching the exported view.
| Comment | File | Size | Author |
|---|---|---|---|
| view-datetime.txt | 3.71 KB | onhover |
Comments
Comment #1
choster commentedThis might be the problem I am experiencing as well: http://drupal.org/node/260550 ; I filed it under views and it was moved back to date.
The FROM_UNIXTIME is found both date_api_sql.inc and line 1070 of views.module.
Comment #2
karens commentedMove to the latest dev version and see if you still have problems. There have been a number of changes since beta 1.
Comment #3
onhover commentedKaren, I tried accomplishing by filter and argument, both still show same problem. Downloaded the newest drupal6, cck, date, and views today.
I believe this is the same or closely related to choster's 260550 that you updated today.
I set up a content type "comingevents" with a datetime field. I want to create a view so that only those nodes where the datetime field is higer than the current time can display. I tried both a filter and an argument. In both cases, views generates SQL callig FROM_UNIXTIME on the field. CCK has stored the value as a datetime field. The views don't have any results. I believe the problem is the calls to "FROM_UNIXTIME".
Not that it's likely to be of much interest, but just in case, here's the generated sql:
When I set up an argument:
Comment #4
onhover commentedComment #5
onhover commentedIn date_views.inc, in the function sql_field, I commented out the call to FROM_UNIXTIME($field) for data types that need it. Then the view I had designed worked as I wanted it to.
SO, I conclude that, in that function, $this->datetype is mis-set to "int". I don't think I have the expertise to track down why this is happening.
Thanks
Comment #6
karens commentedI just released a new 6.2-beta2 version for Date, so update to the latest code for Date and also get the latest -dev version of the Views module, which has some date-related changes that are needed for the Date views handling. If you use the Calendar module, get the new 6.2-beta2 version of that as well.
If you still have problems after that, open a new issue marked with the beta2 version so I know it's still a problem there.
Comment #7
Fanvik commentedIn beta3 this problem is still here.
Comment #8
Fanvik commentedIn beta3 this problem is still here.
Comment #9
karens commentedThat's the problem -- date_views.inc is no longer needed and has been removed, but you have an older copy floating around and it is doing the wrong things. I just made a new commit that creates a blank date_views.inc file so this won't happen.
Comment #10
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #11
osocurioso commentedI have the same problem as onhover with FROM_UNIXTIME applied to MySQL datetime datatypes in beta3, and as far as I can tell, there is no date_views.inc in my installation (I started with a fresh install using beta3).
The relevant part of date_api_sql.inc reads:
However, it seems as though the type of the date field (line 155) is not recognized as DATE_DATETIME even though it is stored as a MySQL datetime type. I tried to find out where/how $this->date_type was assigned its value, but due to unfamiliarity with both Drupal and PHP I didn't get very far along that track.
For reference, the generated SQL in my case is:
where
node_data_field_start_time.field_start_time_valueis a MySQL datetime field defined through CCK.Comment #12
karens commentedBeta3 is out of date, you need to use the latest -dev code. And this is a closed issue.
Comment #13
wundo commentedIf beta3 is outdated, the best thing to do is release beta4, don't you think?
Comment #14
wundo commentedI've just created a feature request about that.