1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Fixes for created_at query

This commit is contained in:
David Bomba 2022-12-21 20:04:41 +11:00
parent d0f18647ed
commit 27df35ef81

View File

@ -174,22 +174,30 @@ abstract class QueryFilters
} }
} }
public function created_at($value) public function created_at($value = '')
{ {
$created_at = $value ? (int) $value : 0;
if($value == '')
return $this->builder;
$created_at = date('Y-m-d H:i:s', $value); try{
if(is_string($created_at)){ if(is_numeric($value)){
$created_at = Carbon::createFromTimestamp((int)$value);
}
else{
$created_at = Carbon::parse($value);
}
$created_at = strtotime(str_replace("/","-",$created_at)); return $this->builder->where('created_at', '>=', $created_at);
if(!$created_at)
return $this->builder;
} }
catch(\Exception $e) {
return $this->builder->where('created_at', '>=', $created_at); return $this->builder;
}
} }
public function is_deleted($value) public function is_deleted($value)