diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php
index 4c299869358fe9d4b0d596b73953df7795561d6e..4ad0d061fc4e3728c982a8ea9827da93bc6bc786 100644
--- a/include/ajax.tickets.php
+++ b/include/ajax.tickets.php
@@ -191,7 +191,9 @@ class TicketsAjaxAPI extends AjaxController {
         //dates
         $startTime  =($req['startDate'] && (strlen($req['startDate'])>=8))?strtotime($req['startDate']):0;
         $endTime    =($req['endDate'] && (strlen($req['endDate'])>=8))?strtotime($req['endDate']):0;
-		$endTime += (60 * 60 * 24) - 1;	// $endTime should be the last second of the day, not the first like $startTime
+        if ($endTime)
+            // $endTime should be the last second of the day, not the first like $startTime
+            $endTime += (60 * 60 * 24) - 1;
         if( ($startTime && $startTime>time()) or ($startTime>$endTime && $endTime>0))
             $startTime=$endTime=0;