Browse files

BUG Filter pages by LastEdited always returns an empty list

This is caused by the input date values entered by the user are passed into query without converting in a correct format first.
  • Loading branch information...
1 parent 8c1f622 commit e5401668faa9cff780202cb492c7b5c772c35249 @phalkunz phalkunz committed Aug 30, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 code/controllers/CMSSiteTreeFilter.php
View
6 code/controllers/CMSSiteTreeFilter.php
@@ -194,11 +194,13 @@ public function pagesIncluded() {
break;
case 'LastEditedFrom':
- $query->where("\"LastEdited\" >= '$SQL_val'");
+ $fromDate = new DateField(null, null, $SQL_val);
+ $query->where("\"LastEdited\" >= '{$fromDate->dataValue()}'");
break;
case 'LastEditedTo':
- $query->where("\"LastEdited\" <= '$SQL_val'");
+ $toDate = new DateField(null, null, $SQL_val);
+ $query->where("\"LastEdited\" <= '{$toDate->dataValue()}'");
break;
case 'ClassName':

0 comments on commit e540166

Please sign in to comment.