Skip to content

Commit

Permalink
sync: Fix date selection
Browse files Browse the repository at this point in the history
  • Loading branch information
niol authored and jtojnar committed Sep 7, 2020
1 parent 92c07a8 commit b9b6803
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/controllers/Items/Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ public function sync(Base $f3) {
}

$since = new \DateTime($params['since']);
$since->setTimeZone(new \DateTimeZone(date_default_timezone_get()));

$last_update = new \DateTime($this->itemsDao->lastUpdate());

$sync = [
'lastUpdate' => $last_update->format('Y-m-d H:i:s'),
'lastUpdate' => $last_update->format(\DateTime::ATOM),
];

$sinceId = 0;
Expand All @@ -72,6 +73,7 @@ public function sync(Base $f3) {
$sinceId = $this->itemsDao->lowestIdOfInterest() - 1;
// only send 1 day worth of items
$notBefore = new \DateTime();
$notBefore->setTimeZone(new \DateTimeZone(date_default_timezone_get()));
$notBefore->sub(new \DateInterval('P1D'));
}

Expand Down

0 comments on commit b9b6803

Please sign in to comment.