filament icon indicating copy to clipboard operation
filament copied to clipboard

DatePicker doesn't reset to null

Open Frameck opened this issue 3 years ago • 1 comments

Package

filament/forms

Package Version

v2.15.18

Laravel Version

v8.83.23

Livewire Version

v2.10.7

PHP Version

PHP 8.0.21

Problem description

When the user check a toggle i need to set a DatePicker to the current date (this works), but the opposite doesn't, so when the toggle is unchecked the DatePicker wont't reset to null.

Expected behavior

The DatePicker should reset it's value to null

Steps to reproduce

DatePicker::make('account_deactivation_date') ->displayFormat('d/m/Y'), Toggle::make('retire_account') ->required() ->reactive() ->afterStateUpdated(function (Closure $set, $state) { if ($state) { $set('account_deactivation_date', now()); } else { // here should set the empty value $set('account_deactivation_date', null); } }),

Reproduction repository

https://github.com

Relevant log output

No response

Frameck avatar Aug 24 '22 13:08 Frameck

Hey @Frameck! We're sorry to hear that you've hit this issue. 💛

However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue?

We need a public Git repository which contains a Laravel app with the minimal amount of Filament code to reproduce the problem. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly.

github-actions[bot] avatar Aug 24 '22 13:08 github-actions[bot]

Should be fixed by #4197.

danharrin avatar Sep 25 '22 20:09 danharrin