From ada131a7c5c542436803c822bac8500bb13444de Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 3 Mar 2014 21:10:09 +0100 Subject: [PATCH] Fixed small bug in date parsing --- src/Models/SearchParsers/PostSearchParser.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Models/SearchParsers/PostSearchParser.php b/src/Models/SearchParsers/PostSearchParser.php index c8f0eb90..a74024e7 100644 --- a/src/Models/SearchParsers/PostSearchParser.php +++ b/src/Models/SearchParsers/PostSearchParser.php @@ -273,11 +273,14 @@ class PostSearchParser extends AbstractSearchParser protected static function parseDate($value) { list ($year, $month, $day) = explode('-', $value . '-0-0'); - $yearMin = $yearMax = intval($year); - $monthMin = $monthMax = intval($month); + $year = intval($year); + $month = intval($month); + $day = intval($day); + $yearMin = $yearMax = $year; + $monthMin = $monthMax = $month; $monthMin = $monthMin ?: 1; $monthMax = $monthMax ?: 12; - $dayMin = $dayMax = intval($day); + $dayMin = $dayMax = $day; $dayMin = $dayMin ?: 1; $dayMax = $dayMax ?: intval(date('t', mktime(0, 0, 0, $monthMax, 1, $year))); $timeMin = mktime(0, 0, 0, $monthMin, $dayMin, $yearMin);