aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/ApiBundle/Controller/EntryRestController.php2
-rw-r--r--src/Wallabag/CoreBundle/Helper/ContentProxy.php9
2 files changed, 9 insertions, 2 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
index cc2cca64..c3ba1858 100644
--- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
@@ -286,7 +286,7 @@ class EntryRestController extends WallabagRestController
286 * {"name"="content", "dataType"="string", "required"=false, "description"="Content of the entry"}, 286 * {"name"="content", "dataType"="string", "required"=false, "description"="Content of the entry"},
287 * {"name"="language", "dataType"="string", "required"=false, "description"="Language of the entry"}, 287 * {"name"="language", "dataType"="string", "required"=false, "description"="Language of the entry"},
288 * {"name"="preview_picture", "dataType"="string", "required"=false, "description"="Preview picture of the entry"}, 288 * {"name"="preview_picture", "dataType"="string", "required"=false, "description"="Preview picture of the entry"},
289 * {"name"="published_at", "dataType"="datetime", "format"="YYYY-MM-DDTHH:II:SS+TZ", "required"=false, "description"="Published date of the entry"}, 289 * {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"},
290 * {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"}, 290 * {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"},
291 * } 291 * }
292 * ) 292 * )
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
82 $entry->setHttpStatus(isset($content['status']) ? $content['status'] : ''); 82 $entry->setHttpStatus(isset($content['status']) ? $content['status'] : '');
83 83
84 if (!empty($content['date'])) { 84 if (!empty($content['date'])) {
85 $date = $content['date'];
86
87 // is it a timestamp?
88 if (filter_var($date, FILTER_VALIDATE_INT) !== false) {
89 $date = '@'.$content['date'];
90 }
91
85 try { 92 try {
86 $entry->setPublishedAt(new \DateTime($content['date'])); 93 $entry->setPublishedAt(new \DateTime($date));
87 } catch (\Exception $e) { 94 } catch (\Exception $e) {
88 $this->logger->warning('Error while defining date', ['e' => $e, 'url' => $url, 'date' => $content['date']]); 95 $this->logger->warning('Error while defining date', ['e' => $e, 'url' => $url, 'date' => $content['date']]);
89 } 96 }