summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2016-08-28 09:11:53 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2016-08-28 09:11:53 +0200
commit575a10ec2d4b5e1a6bb3e8def87b6be0d9272cc1 (patch)
tree1cbded3a115f358adac7377f12c6b96233028502
parent1f6af77fff02d227c0638bdb8dd6efebca80e7ce (diff)
fix last modified cropping
-rw-r--r--lib/Db/Item.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Db/Item.php b/lib/Db/Item.php
index 1909019c1..a208cc798 100644
--- a/lib/Db/Item.php
+++ b/lib/Db/Item.php
@@ -150,7 +150,7 @@ class Item extends Entity implements IAPI, \JsonSerializable {
'feedId' => $this->getFeedId(),
'unread' => $this->isUnread(),
'starred' => $this->isStarred(),
- 'lastModified' => (int) substr($this->getLastModified(), 0, -6),
+ 'lastModified' => $this->cropApiLastModified(),
'rtl' => $this->getRtl(),
'fingerprint' => $this->getFingerprint(),
'contentHash' => $this->getContentHash()
@@ -252,4 +252,16 @@ class Item extends Entity implements IAPI, \JsonSerializable {
));
}
+ /**
+ * @return int
+ */
+ public function cropApiLastModified() {
+ $lastModified = $this->getLastModified();
+ if (strlen((string)$lastModified > 10)) {
+ return (int)substr($lastModified, 0, -6);
+ } else {
+ return $lastModified;
+ }
+ }
+
}