Skip to content
This repository was archived by the owner on Jan 27, 2025. It is now read-only.

Commit 7093f75

Browse files
Merge pull request #73 from johncarter-/fix/dated-collection-synthesizer
Ensure date can be parsed by `Entry::make()`
2 parents 676844e + 19b5a57 commit 7093f75

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Synthesizers/EntryCollectionSynthesizer.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Livewire\Mechanisms\HandleComponents\Synthesizers\Synth;
66
use Statamic\Entries\Entry;
77
use Statamic\Entries\EntryCollection as StatamicEntryCollection;
8+
use Illuminate\Support\Carbon;
89

910
class EntryCollectionSynthesizer extends Synth
1011
{
@@ -44,7 +45,13 @@ public function hydrate($values)
4445
->data($value['data']);
4546

4647
if ($value['date']) {
47-
$entry->date($value['date'] ?? null);
48+
$date = $value['date'];
49+
50+
if (!$date instanceof \Carbon\CarbonInterface) {
51+
$date = Carbon::parse($date);
52+
}
53+
54+
$entry->date($date ?? null);
4855
}
4956

5057
$items[] = $entry;

0 commit comments

Comments
 (0)