How to reactively update the `displayFormat()` of DatePicker?

This will not work. It shows the display format changed in the html, but not in the UI:
Select::make('date_format')
    ->options(DateFormat::class)
    ->required()
    ->live()
    ->markAsRequired(false),
DatePicker::make('fiscal_year_start')
    ->label('Start')
    ->live()
    ->native(false)
    ->maxDate(static fn (Get $get) => $get('fiscal_year_end'))
    ->displayFormat(static function(Get $get) {
        return $get('date_format') ?? DateFormat::DEFAULT;
    })
    ->seconds(false)
    ->required()
    ->localizeLabel()
    ->markAsRequired(false),
Solution
Hey, just wanted to check up on this and let you know that I found a fix/hack using this:
Select::make('date_format')
    ->options(DateFormat::class)
    ->required()
    ->live()
    ->markAsRequired(false),
DatePicker::make('fiscal_year_start')
    ->label('Start')
    ->live()
    ->extraAttributes(['wire:key' => Str::random()]) // HERE...
    ->native(false)
    ->maxDate(static fn (Get $get) => $get('fiscal_year_end'))
    ->displayFormat(static function(Get $get) {
        return $get('date_format') ?? DateFormat::DEFAULT;
    })
    ->seconds(false)
    ->required()
    ->localizeLabel()
    ->markAsRequired(false),
Was this page helpful?