Skip to content
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
Showing with 4 additions and 2 deletions.
  1. +4 −2 code/controllers/CMSSiteTreeFilter.php
6 code/controllers/CMSSiteTreeFilter.php
@@ -194,11 +194,13 @@ public function pagesIncluded() {
case 'LastEditedFrom':
- $query->where("\"LastEdited\" >= '$SQL_val'");
+ $fromDate = new DateField(null, null, $SQL_val);
+ $query->where("\"LastEdited\" >= '{$fromDate->dataValue()}'");
case 'LastEditedTo':
- $query->where("\"LastEdited\" <= '$SQL_val'");
+ $toDate = new DateField(null, null, $SQL_val);
+ $query->where("\"LastEdited\" <= '{$toDate->dataValue()}'");
case 'ClassName':

0 comments on commit e540166

Please sign in to comment.
Something went wrong with that request. Please try again.