Skip to content

Commit

Permalink
Make fetch_incidents() date search from beginning till end of day #220
Browse files Browse the repository at this point in the history
This makes sure we still get results if from and to dates are the same.
Also more closely matches what a user would expect
  • Loading branch information
rjmackay committed Oct 24, 2012
1 parent 09b0491 commit 03d324e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions application/helpers/reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,9 @@ public static function fetch_incidents($paginate = FALSE, $items_per_page = 0)
//
if (isset($url_data['from']) AND isset($url_data['to']))
{
$date_from = date('Y-m-d', strtotime($url_data['from']));
$date_to = date('Y-m-d', strtotime($url_data['to']));
// Add hours/mins/seconds so we still get reports if from and to are the same day
$date_from = date('Y-m-d 00:00:00', strtotime($url_data['from']));
$date_to = date('Y-m-d 23:59:59', strtotime($url_data['to']));

array_push(self::$params,
'i.incident_date >= "'.$date_from.'"',
Expand Down

0 comments on commit 03d324e

Please sign in to comment.