ticket search for "this month", RT#11057
[freeside.git] / rt / lib / RT / Tickets_Overlay.pm
index 89d64c5..e3658fe 100644 (file)
@@ -539,11 +539,22 @@ sub _DateFieldLimit {
         # if we're specifying =, that means we want everything on a
         # particular single day.  in the database, we need to check for >
         # and < the edges of that day.
-
-        $date->SetToMidnight( Timezone => 'server' );
-        my $daystart = $date->ISO;
-        $date->AddDay;
-        my $dayend = $date->ISO;
+       
+        my ($daystart, $dayend);
+        if ( lc($value) eq 'this month' ) { 
+            # special case: > and < the edges of this month
+            $date->SetToNow;
+            $date->SetToStart('month');
+            $daystart = $date->ISO;
+            $date->AddMonth;
+            $dayend = $date->ISO;
+        }
+        else {
+            $date->SetToMidnight( Timezone => 'server' );
+            $daystart = $date->ISO;
+            $date->AddDay;
+            $dayend = $date->ISO;
+        }
 
         $sb->_OpenParen;