X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=src%2FWallabag%2FCoreBundle%2FHelper%2FContentProxy.php;h=8ba77ca921341e60550fb17588980c307a541253;hb=14b8a7c950147d32d7c9782832b87bf2b18b4fd7;hp=90d0c50d3a83fb74b09817c8362761e8bfad9195;hpb=9e349f08a651c43c6d5dd890303ed529c38c4fde;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 90d0c50d..8ba77ca9 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -82,8 +82,15 @@ class ContentProxy $entry->setHttpStatus(isset($content['status']) ? $content['status'] : ''); if (!empty($content['date'])) { + $date = $content['date']; + + // is it a timestamp? + if (filter_var($date, FILTER_VALIDATE_INT) !== false) { + $date = '@'.$content['date']; + } + try { - $entry->setPublishedAt(new \DateTime($content['date'])); + $entry->setPublishedAt(new \DateTime($date)); } catch (\Exception $e) { $this->logger->warning('Error while defining date', ['e' => $e, 'url' => $url, 'date' => $content['date']]); }