DatePicker and unique: Format is ignored.

I have a DatePicker with the following methods:

DatePicker::make("published_at")
    ->unique(callback: function(Unique $rule, $livewire) {
        return $rule
            ->where("featured_type_id", $livewire->ownerRecord->id);
    })
    ->format("Y-m-d")
    ->displayFormat("Y-m-d")
    ->default(now()->format("Y-m-d"))
    ->required()


The published_at field is just a date SQL column (without time). In the form, I wanna see and save the date in Y-m-d format, which is working.

The problem is, that the unique rule never hits, because the generated query (checked it in telescope) is the following:

select
  count(*) as aggregate
from
  `recipes`
where
  `published_at` = '2023-03-31 11:39:34'
  and `featured_type_id` = '1'
Was this page helpful?