Skip to content

[Bug]: Carbon\Exceptions\InvalidFormatException #128

Closed

Description

@haggaiwambua

What happened?

A multiple date picker component returns selected dates as a comma-separated string like "2025-10-06,2025-10-13,2025-10-14,2025-10-23,2025-10-24 which is parsed as a string instead of an array. Using the dehydrateStateUsing() method to transform it doesn't work.

How to reproduce the bug

Add the following component to a form and submit it.

Flatpickr::make('days_not_worked')
  ->label('Days not worked')
  ->required()
  ->multiplePicker()
  ->altFormat('M j'),

Package Version

5.0.0

PHP Version

8.3.21

Laravel Version

v12.36.1

Which operating systems does with happen with?

macOS

Notes

No response

Activity

  1. jluitz commented on Nov 19, 2025

    @jluitz

    I had the same issue with multiplePicker. It is caused by the getDefaultStateCasts() from DateTimePicker.

    My quick fix is to override it in Flatpickr.php by adding this function:

    public function getDefaultStateCasts(): array
    {
        if ($this->isMultiplePicker()) {
            return $stateCasts= [];
        }
    
        return parent::getDefaultStateCasts();
    }
    

    Evidently for the rangePicker a different fix will be needed.

  2. remedix commented on Dec 3, 2025

    @remedix

    Any updates on this ? I have the same issue when using ->multiplePicker()

  3. coolsam726 commented on Jun 13, 2026

    @coolsam726
    Owner

    Fixed in #144 (and #143 where applicable). Closing manually because the PR did not include Closes #128 keywords for auto-close on merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions