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;
$created_at = date('Y-m-d H:i:s', $value);
if($value == '')
return $this->builder;
if(is_string($created_at)){
try{
$created_at = strtotime(str_replace("/","-",$created_at));
if(is_numeric($value)){
$created_at = Carbon::createFromTimestamp((int)$value);
}
else{
$created_at = Carbon::parse($value);
}
if(!$created_at)
return $this->builder;
return $this->builder->where('created_at', '>=', $created_at);
}
catch(\Exception $e) {
return $this->builder;
}
return $this->builder->where('created_at', '>=', $created_at);
}
public function is_deleted($value)