diff options
| author | 2025-11-30 21:42:46 +0100 | |
|---|---|---|
| committer | 2025-11-30 21:42:46 +0100 | |
| commit | 023cdf0d7a6408f670fb0ef5c60e65bd0bd409a9 (patch) | |
| tree | 505deacbc0250df7588a9959d8e1c68f4b3752f2 /app/Utils | |
| parent | 76f5bee76d4640169d9a506b5b107f787797879c (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/Utils')
| -rw-r--r-- | app/Utils/dotNotationUtil.php | 4 |
1 files changed, 4 insertions, 0 deletions
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); |
