Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit a1d24bd

Browse files
committed
Merge pull request #26 from API-Skeletons/master
Set time to midnight for date datatypes in PHP
2 parents 70aa1ba + f742908 commit a1d24bd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Filter/ORM/AbstractFilter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ protected function typeCastField($metadata, $field, $value, $format, $doNotTypec
5555
settype($value, 'float');
5656
break;
5757
case 'date':
58+
// For dates set time to midnight
5859
if ($value && ! $doNotTypecastDatetime) {
5960
if (! $format) {
6061
$format = 'Y-m-d';
6162
}
6263
$value = DateTime::createFromFormat($format, $value);
64+
$value = DateTime::createFromFormat('Y-m-d H:i:s', $value->format('Y-m-d') . ' 00:00:00');
6365
}
6466
break;
6567
case 'time':

0 commit comments

Comments
 (0)