]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Helper/ContentProxy.php
Forced date can now be a timestamp too
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Helper / ContentProxy.php
index 90d0c50d3a83fb74b09817c8362761e8bfad9195..8ba77ca921341e60550fb17588980c307a541253 100644 (file)
@@ -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']]);
             }