diff options
Diffstat (limited to 'lib/Db')
-rw-r--r-- | lib/Db/Item.php | 14 |
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; + } + } + } |