Commit 5ad042a7 authored by John Long's avatar John Long

Item: Add handling for invalid pubdate items

Ticket: N/A
parent fa5f7c20
Pipeline #63425452 passed with stages
in 1 minute and 19 seconds
......@@ -3,6 +3,7 @@
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
class Item extends Model
{
......@@ -41,4 +42,15 @@ class Item extends Model
$this->attributes['itunes_duration'] = $duration;
}
public function getPubDateAttribute($pub_date)
{
$date = date_create($pub_date);
if (!$date) {
$date = new \DateTime('@0');
}
return Carbon::instance($date);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment