]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/History.php
Add history entries for API endpoint
[github/shaarli/Shaarli.git] / application / History.php
index f93b03568235c1f71ecc7d9d86b21e0a56fab34b..116b9264019c2a667e19f2d1e47aee0d5ab0b362 100644 (file)
@@ -135,7 +135,7 @@ class History
 
         $item = [
             'event' => $status,
-            'datetime' => (new DateTime())->format(DateTime::ATOM),
+            'datetime' => new DateTime(),
             'id' => $id !== null ? $id : '',
         ];
         $this->history = array_merge([$item], $this->history);
@@ -177,7 +177,7 @@ class History
     {
         $comparaison = new DateTime('-'. $this->retentionTime . ' seconds');
         foreach ($this->history as $key => $value) {
-            if (DateTime::createFromFormat(DateTime::ATOM, $value['datetime']) < $comparaison) {
+            if ($value['datetime'] < $comparaison) {
                 unset($this->history[$key]);
             }
         }