aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Feed.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-11-30 21:42:46 +0100
committerGravatar GitHub <noreply@github.com> 2025-11-30 21:42:46 +0100
commit023cdf0d7a6408f670fb0ef5c60e65bd0bd409a9 (patch)
tree505deacbc0250df7588a9959d8e1c68f4b3752f2 /app/Models/Feed.php
parent76f5bee76d4640169d9a506b5b107f787797879c (diff)
Web scraping support date format epoch milliseconds (#8266)
fix https://github.com/FreshRSS/FreshRSS/discussions/8264 Auto detect whether a `U` date format should be in seconds or milliseconds.
Diffstat (limited to 'app/Models/Feed.php')
-rw-r--r--app/Models/Feed.php4
1 files changed, 4 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);