From 813849e5216cb87121e0f778a734575be6a36052 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sun, 7 May 2017 16:50:20 +0200 Subject: Add history entries for API endpoint CHANGED: datetime is now store as an object in history store file --- application/History.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'application/History.php') diff --git a/application/History.php b/application/History.php index f93b0356..116b9264 100644 --- a/application/History.php +++ b/application/History.php @@ -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]); } } -- cgit v1.2.3