Skip to content

Commit 50bf797

Browse files
committed
Fix toRfc3339String
1 parent 3a6477e commit 50bf797

File tree

6 files changed

+21
-4
lines changed

6 files changed

+21
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to `laravel-feed` will be documented in this file
44

5+
## 3.1.2 - 2020-12-09
6+
7+
- Fix issue with Rfc3339 string
8+
59
## 3.1.1 - 2020-12-07
610

711
- RFC3339 compliant updated field (#136)

resources/views/atom.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<![CDATA[{!! $category !!}]]>
3232
</category>
3333
@endforeach
34-
<updated>{{ $item->updated->toRssString() }}</updated>
34+
<updated>{{ $item->updated->toRfc3339String() }}</updated>
3535
</entry>
3636
@endforeach
3737
</feed>

resources/views/rss.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<description><![CDATA[{!! $item->summary !!}]]></description>
1818
<author><![CDATA[{{ $item->author }}]]></author>
1919
<guid>{{ url($item->id) }}</guid>
20-
<pubDate>{{ $item->updated->toRssString() }}</pubDate>
20+
<pubDate>{{ $item->updated->toRfc3339String() }}</pubDate>
2121
@foreach($item->category as $category)
2222
<category>{{ $category }}</category>
2323
@endforeach

src/Feed.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ protected function lastUpdated(): string
9494

9595
return $this->feedItems->sortBy(function ($feedItem) {
9696
return $feedItem->updated;
97-
})->last()->updated->toRssString();
97+
})->last()->updated->toRfc3339String();
9898
}
9999
}

src/FeedItem.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function title(string $title): self
6262

6363
public function updated(Carbon $updated): self
6464
{
65-
$this->updated = $updated->toRfc3339String();
65+
$this->updated = $updated;
6666

6767
return $this;
6868
}

tests/FeedItemTest.php

+13
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,17 @@ public function a_feed_is_invalid_if_a_field_is_missing()
1414

1515
FeedItem::create()->validate();
1616
}
17+
18+
/** @test * */
19+
public function it_can_be_created_without_errors()
20+
{
21+
FeedItem::create()
22+
->title('A title')
23+
->category('a category')
24+
->link('https://spatie.be')
25+
->author('an author')
26+
->updated(now());
27+
28+
$this->expectNotToPerformAssertions();
29+
}
1730
}

0 commit comments

Comments
 (0)