Skip to content

Commit

Permalink
Date issues in Bolt 5 (#2986)
Browse files Browse the repository at this point in the history
* Fix the format and fix typo

* Fix Ivo's suggestion :D

* Revert changes back

The database doesnt store date field values as Zulu therefore this was not actually needed

* Fix the format the date is saved in and update the query
  • Loading branch information
Joossensei committed Dec 3, 2021
1 parent 8d9518c commit 42fedf2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion assets/js/app/editor/Components/Date.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default {
wrap: true,
altFormat: 'F j, Y',
altInput: true,
dateFormat: 'Z',
dateFormat: 'Y-m-d h:i',
enableTime: false,
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/SelectQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,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 = Carbon::parse((string) strtotime($param))->toIso8601ZuluString('milisecond');
$param = date('Y-m-d h:i', strtotime($param));
}

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

0 comments on commit 42fedf2

Please sign in to comment.