Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 2.2.1
-
Fix Version/s: 2.2.4
-
Component/s: Drupal Integration Modules
-
Labels:None
Description
When building a view using the Drupal views module and integrating it with CiviCRM to display events, attempting to sort by the event start date yields unpredictable results.
The cause seems to be the handling of dates as timestamps vs. dates as datetime field.
It seems that the Drupal views module always assumes the date is a timestamp.
Currently, the civicrm code gets around that problem by converting the datetime formatted field into an integer so it can be displayed properly when views renders.
However, for sorting, this approach doesn't work since the views module creates a sql ORDER BY that sorts the results before the civicrm code has a chance to convert the datetime field into a time stamp.
I'm really not sure what the best way to fix this problem is. I suspect that the views api should be better written to accept different types.
In any event, I'm attaching a fix to civicrm code that does seem to solve the problem - even if it's not the best fix.
jamie