summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php')
-rw-r--r--vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php
index 21566527e..0e53d2778 100644
--- a/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php
+++ b/vendor/fguillot/picofeed/lib/PicoFeed/Parser/Atom.php
@@ -138,16 +138,20 @@ class Atom extends Parser
* Find the item date
*
* @access public
- * @param SimpleXMLElement $entry Feed item
- * @param Item $item Item object
+ * @param SimpleXMLElement $entry Feed item
+ * @param Item $item Item object
+ * @param \PicoFeed\Parser\Feed $feed Feed object
*/
- public function findItemDate(SimpleXMLElement $entry, Item $item)
+ public function findItemDate(SimpleXMLElement $entry, Item $item, Feed $feed)
{
$published = isset($entry->published) ? $this->date->getDateTime((string) $entry->published) : null;
$updated = isset($entry->updated) ? $this->date->getDateTime((string) $entry->updated) : null;
- if ($published !== null && $updated !== null) {
- $item->date = max($published, $updated);
+ if ($published === null && $updated === null) {
+ $item->date = $feed->getDate(); // We use the feed date if there is no date for the item
+ }
+ else if ($published !== null && $updated !== null) {
+ $item->date = max($published, $updated); // We use the most recent date between published and updated
}
else {
$item->date = $updated ?: $published;