© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
9 replies
bernhard

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()
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
published_at
field is just a
date
date
SQL column (without time). In the form, I wanna see and save the date in
Y-m-d
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'
select
  count(*) as aggregate
from
  `recipes`
where
  `published_at` = '2023-03-31 11:39:34'
  and `featured_type_id` = '1'
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Datepicker date format
FilamentFFilament / ❓┊help
3y ago
datepicker format not working inside wizard
FilamentFFilament / ❓┊help
3y ago
DatePicker (Month and Year)
FilamentFFilament / ❓┊help
2y ago
datepicker
FilamentFFilament / ❓┊help
2y ago