prepareDateForDb method switch your date/time to UTC timezone and because of this user wouldn't see new created items.
In my case new \DateTime() shows
object(DateTime)#1496 (3) { ["date"]=> string(26) "2021-04-09 12:46:34.850212" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Oslo" }
but after prepare prepareDateForDb method, this variable $currentTimeDb became
2021-04-09 10:46:34
So if i'll create some entry it'll be available for search only after 2hours.
Hi
There is an issue with date/time that is used to compare with postDate. At this line https://github.com/la-haute-societe/craft-elasticsearch/blob/master/src/records/ElasticsearchRecord.php#L424
$currentTimeDb = Db::prepareDateForDb(new \DateTime());
prepareDateForDb method switch your date/time to UTC timezone and because of this user wouldn't see new created items. In my case new \DateTime() shows
object(DateTime)#1496 (3) { ["date"]=> string(26) "2021-04-09 12:46:34.850212" ["timezone_type"]=> int(3) ["timezone"]=> string(11) "Europe/Oslo" }
but after prepare prepareDateForDb method, this variable $currentTimeDb became
2021-04-09 10:46:34
So if i'll create some entry it'll be available for search only after 2hours.