Skip to content

Commit

Permalink
Fix the date format expected for params like 'today'
Browse files Browse the repository at this point in the history
  • Loading branch information
Joossensei authored and bobdenotter committed Nov 28, 2021
1 parent 79a1cb6 commit 729b23e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Storage/SelectQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Bolt\Entity\Field\CheckboxField;
use Bolt\Entity\Field\NumberField;
use Bolt\Entity\Field\SelectField;
use Carbon\Carbon;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query\Expr\Andx;
use Doctrine\ORM\Query\Expr\Base;
Expand Down Expand Up @@ -329,7 +330,7 @@ public function build(): QueryBuilder
$fieldName = preg_replace('/(_[0-9]+)$/', '', $key);
// Use strtotime on 'date' fields to allow selections like "today", "in 3 weeks" or "this year"
if (in_array($fieldName, $dateFields, true) && (strtotime($param) !== false)) {
$param = date('c', strtotime($param));
$param = Carbon::parse(strtotime($param))->toIso8601ZuluString('milisecond');
}

if (in_array($fieldName, $this->regularFields, true) && ! in_array($fieldName, $numberFields, true)) {
Expand Down

0 comments on commit 729b23e

Please sign in to comment.