diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/ContentProxy.php | 10 | ||||
-rw-r--r-- | src/Wallabag/ImportBundle/Controller/BrowserController.php | 12 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 656ac6ee..1ac7ad83 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -126,11 +126,17 @@ class ContentProxy | |||
126 | 126 | ||
127 | // is it a timestamp? | 127 | // is it a timestamp? |
128 | if (filter_var($date, FILTER_VALIDATE_INT) !== false) { | 128 | if (filter_var($date, FILTER_VALIDATE_INT) !== false) { |
129 | $date = '@' . $value; | 129 | $date = '@' . $date; |
130 | } | 130 | } |
131 | 131 | ||
132 | try { | 132 | try { |
133 | $entry->setPublishedAt(new \DateTime($date)); | 133 | // is it already a DateTime? |
134 | // (it's inside the try/catch in case of fail to be parse time string) | ||
135 | if (!$date instanceof \DateTime) { | ||
136 | $date = new \DateTime($date); | ||
137 | } | ||
138 | |||
139 | $entry->setPublishedAt($date); | ||
134 | } catch (\Exception $e) { | 140 | } catch (\Exception $e) { |
135 | $this->logger->warning('Error while defining date', ['e' => $e, 'url' => $entry->getUrl(), 'date' => $value]); | 141 | $this->logger->warning('Error while defining date', ['e' => $e, 'url' => $entry->getUrl(), 'date' => $value]); |
136 | } | 142 | } |
diff --git a/src/Wallabag/ImportBundle/Controller/BrowserController.php b/src/Wallabag/ImportBundle/Controller/BrowserController.php index 0753e318..77a7a904 100644 --- a/src/Wallabag/ImportBundle/Controller/BrowserController.php +++ b/src/Wallabag/ImportBundle/Controller/BrowserController.php | |||
@@ -80,10 +80,10 @@ abstract class BrowserController extends Controller | |||
80 | */ | 80 | */ |
81 | abstract protected function getImportService(); | 81 | abstract protected function getImportService(); |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Return the template used for the form. | 84 | * Return the template used for the form. |
85 | * | 85 | * |
86 | * @return string | 86 | * @return string |
87 | */ | 87 | */ |
88 | abstract protected function getImportTemplate(); | 88 | abstract protected function getImportTemplate(); |
89 | } | 89 | } |