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

Exception "Livewire Calendar not correctly configured. Check initial inputs." when changing months #35

Closed
maatien opened this issue Oct 2, 2024 · 0 comments

Comments

@maatien
Copy link
Contributor

maatien commented Oct 2, 2024

This error concerns:

The Exception "Livewire Calendar not correctly configured. Check initial inputs." appears again in Oct 2024 when switching from October to November with APP_TIMEZONE set to Europe/Berlin.
In Germany, on 2024-10-27 the timezone is changed from +02:00 to +01:00 due to summer time / winter time change.

LivewireCalendar.php:173

    public function monthGrid()
    {
        $firstDayOfGrid = $this->gridStartsAt; // 2024-10-28 00:00:00.000000 +02:00
        $lastDayOfGrid = $this->gridEndsAt; // 2024-12-01 23:59:59.999999 +01:00

        $numbersOfWeeks = floor(abs($lastDayOfGrid->diffInWeeks($firstDayOfGrid)) + 1); // 6
        $days = floor(abs($lastDayOfGrid->diffInDays($firstDayOfGrid)) + 1); // 36

        if ($days % 7 != 0) {
            // exception is thrown as 36 % 7 != 0
            throw new Exception("Livewire Calendar not correctly configured. Check initial inputs.");
        }

I suspect this error is due to the time zone calculation, as $firstDayOfGrid is in +02:00, where $lastDayOfGrid is in +01:00.

Using the change proposed here fixes the problem locally: asantibanez/livewire-calendar#22 (comment)

Can you please adapt the change and release a new version?

Regards,
Martin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant