Skip to content

Commit

Permalink
[HinduTamilBridge] Fix timestamp again (RSS-Bridge#4142)
Browse files Browse the repository at this point in the history
  • Loading branch information
tillcash authored Jun 28, 2024
1 parent adad9d6 commit d0c3514
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bridges/HinduTamilBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected function parseItem($item)

$date = $dom->find('p span.date', 1);
if ($date) {
$item['timestamp'] = $date->innertext . ' IST';
$item['timestamp'] = $this->convertToRFC3339($date->plaintext);
}

$content = $dom->find('#pgContentPrint', 0);
Expand All @@ -88,4 +88,16 @@ private function cleanContent($content)

return $content;
}

private function convertToRFC3339($DateString)
{
$timestamp = strtotime(trim($DateString));

if ($timestamp !== false) {
$rfc3339DateTime = date('Y-m-d\TH:i:s', $timestamp) . '+05:30';
return $rfc3339DateTime;
} else {
return null;
}
}
}

0 comments on commit d0c3514

Please sign in to comment.