Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dharen008 opened this issue May 3, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@dharen008
Copy link

dharen008 commented May 3, 2024

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

@dharen008 dharen008 added the bug Something isn't working label May 3, 2024
@dharen008 dharen008 changed the title [Bug]: After installation issue, Error code on class Flatpickr [Bug]: After installation issue, Error code on class Flatpickr and couple of things i saw May 3, 2024
@davisngl
Copy link

davisngl commented May 3, 2024

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

@dharen008
Copy link
Author

dharen008 commented May 4, 2024

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
Copy link

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

@dharen008
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants