Skip to content

[Bug]: Different rangeSeparator per locale #103

Description

@underdpt

What happened?

Hello,

I found that using a range picker with some locales throws an error due to the rangeSeparator for the locale being different from the one used on src/Forms/Components/Flatpickr.php:224 when exploding the string:

                if ($component->isRangePicker()) {
                    $range = str($state)->explode(' to ');
                } elseif ($component->isMultiplePicker()) {
                    $range = str($state)->explode($component->getConjunction());
                } else {
                    $range = [$state];
                }

I've been checking and it seems pretty difficult to extract the separator from the locale, so maybe a quick hack might be to add a function to let the dev specify the separator.

How to reproduce the bug

                        Flatpickr::make('fechas')
                            ->rangePicker()
                            ->showMonths(2)
                            ->displayFormat('d/m/Y')
                            ->locale('es')

Package Version

v4.1.0

PHP Version

8.4

Laravel Version

11 - 12

Which operating systems does with happen with?

No response

Notes

No response

Activity

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