aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Models/Feed.php4
-rw-r--r--app/Utils/dotNotationUtil.php4
2 files changed, 8 insertions, 0 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index cd5fa508d..5cf82b718 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -1098,6 +1098,10 @@ class FreshRSS_Feed extends Minz_Model {
$item['author'] = $xPathItemAuthor == '' ? '' : $xpathEvaluateString($xPathItemAuthor, $node);
$item['timestamp'] = $xPathItemTimestamp == '' ? '' : $xpathEvaluateString($xPathItemTimestamp, $node);
if ($xPathItemTimeFormat != '') {
+ if ($xPathItemTimeFormat === 'U' && strlen($item['timestamp']) > 10) {
+ // Compatibility with Unix timestamp in milliseconds
+ $item['timestamp'] = substr($item['timestamp'], 0, -3);
+ }
$dateTime = DateTime::createFromFormat($xPathItemTimeFormat, $item['timestamp']);
if ($dateTime != false) {
$item['timestamp'] = $dateTime->format(DateTime::ATOM);
diff --git a/app/Utils/dotNotationUtil.php b/app/Utils/dotNotationUtil.php
index 89b91bc5b..a8dab260f 100644
--- a/app/Utils/dotNotationUtil.php
+++ b/app/Utils/dotNotationUtil.php
@@ -159,6 +159,10 @@ final class FreshRSS_dotNotation_Util
: $rssItem['content'];
if (isset($dotNotation['itemTimeFormat']) && is_string($dotNotation['itemTimeFormat'])) {
+ if ($dotNotation['itemTimeFormat'] === 'U' && strlen($rssItem['timestamp']) > 10) {
+ // Compatibility with Unix timestamp in milliseconds
+ $rssItem['timestamp'] = substr($rssItem['timestamp'], 0, -3);
+ }
$dateTime = DateTime::createFromFormat($dotNotation['itemTimeFormat'], $rssItem['timestamp']);
if ($dateTime != false) {
$rssItem['timestamp'] = $dateTime->format(DateTime::ATOM);