savannabits / filament-flatpickr

Extend your Filament Date-Picking with Flatpickr
MIT License
42 stars 27 forks source link

[Bug]: After installation issue, Error code on class Flatpickr and couple of things i saw #66

Open dharen008 opened 2 weeks ago

dharen008 commented 2 weeks ago

What happened?

  1. After installing and adding this code:
use Coolsam\FilamentFlatpickr\Forms\Components\Flatpickr;

Flatpickr::make( 'date' )

I encountered a 'class not found' error. Upon inspecting the Flatpickr class file, I found an error on line 502:

    public function minDate(Carbon|string|null $minDate|Closure): static
    {
        $this->minDate = $minDate ? Carbon::parse($minDate) : $minDate;

        return $this;
    }

How to reproduce the bug

I copied the same format for maxDate and changed it to minDate, and now it's fixed:

    public function minDate(Carbon|string|null|Closure $minDate = 'now'): static
    {
        $this->minDate = $minDate ? Carbon::parse($minDate) : $minDate;

        return $this;
    }

after i fix the issue. the frontend is working but on the resource the unknown class is still there

image

What happened?

  1. When your database column type is on time only and using altFormat & altInput will not work it will not auto convert the data value, it will only work on timestamp with date and time on the value

image

Flatpickr::make( 'time_in' )
    ->altFormat( 'h:i K' )
    ->noCalendar( true )
    ->altInput( true )
    ->enableTime(),

What happened?

  1. When using ->altInputClass('sample-class') it will replace all the class on that input class, is there a way to just add that class to the input class
// Resource file
Flatpickr::make( 'time_in' )
    ->altInputClass( 'sample-class' )
    ->altFormat( 'h:i K' )
    ->noCalendar( true )
    ->altInput( true )
    ->enableTime(),

// AppProvider File
Flatpickr::configureUsing( function ( Flatpickr $flatinput ): void {
     $flatinput->altInputClass( 'sample-class' );
} );

What happened?

  1. When using the Flatpickr date picker component to display and select dates with time, there's a discrepancy between the data stored in the database and the output shown to the user.

Database: 2024-05-17 00:00:00 Output: May 17, 2024 8:00 AM

Flatpickr::make('created_at')
    ->altInput(true)
    ->altFormat('F d, Y h:i K')
    ->enableTime(),

Package Version

3.1

PHP Version

8.2

Laravel Version

11

Which operating systems does with happen with?

Windows

Notes

No response

davisngl commented 2 weeks ago

Seems that this bug fix did not get into this minor release, which resulted in syntax error in parameter list.

dharen008 commented 1 week ago

saw another issue when trying to remove. i think this is from the config folder file. it should be delete along with the main files right?

image

HUHAO-mll commented 2 days ago

I get the same issue, have you resolved it? Is there any alternative plugin?

dharen008 commented 1 day ago

I get the same issue, have you resolved it? Is there any alternative plugin?

I stopped using this plugin because it has many issues that need fixing. The DatePicker->native(false) already handles many flatpicker functions, so I decided to stick with the default Filament DatePicker.