Skip to content

Commit

Permalink
Fix dates in localizations when duplicating entries
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Jan 16, 2025
1 parent 5fa2e18 commit 715a3e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Actions/DuplicateEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private function duplicateEntry(Entry $original, ?string $origin = null)
$entry->slug($slug);
}

if ($original->hasDate()) {
if ($original->hasExplicitDate()) {
$entry->date($original->date());
}

Expand Down
5 changes: 5 additions & 0 deletions src/Entries/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,11 @@ public function hasSeconds()
return $this->blueprint()->field('date')->fieldtype()->secondsEnabled();
}

public function hasExplicitDate(): bool
{
return $this->hasDate() && $this->date;
}

public function sites()
{
return $this->collection()->sites();
Expand Down

0 comments on commit 715a3e7

Please sign in to comment.