From 26d592648a5d9b42b83708d8bce651b3cf259531 Mon Sep 17 00:00:00 2001 From: Josh Torres Date: Tue, 19 Mar 2024 08:08:48 -0700 Subject: [PATCH 1/3] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aa924fd..f182129 100755 --- a/README.md +++ b/README.md @@ -35,9 +35,10 @@ You can use `make:livewire` to create a new component. For example. php artisan make:livewire AppointmentsCalendar ``` -In the `AppointmentsCalendar` class, instead of extending from the base `Component` Livewire class, -extend from `LivewireCalendar`. Also, remove the `render` method. -You'll have a class similar to this snippet. +- In the `AppointmentsCalendar` class, instead of extending from the base `Component` Livewire class, +extend from `LivewireCalendar`. +- **Remove the `render` method or you will override the parent and the calendar will not display.** +- You'll have a class similar to this snippet. ``` php class AppointmentsCalendar extends LivewireCalendar From 58d6877226a240b5cb307b110c37d837adb6892a Mon Sep 17 00:00:00 2001 From: Josh Torres Date: Tue, 19 Mar 2024 08:10:16 -0700 Subject: [PATCH 2/3] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index f182129..c21b8fa 100755 --- a/README.md +++ b/README.md @@ -120,8 +120,6 @@ Example This will render a calendar grid. -![example](https://github.com/omnia-digital/livewire-calendar/raw/master/example.png) - By default, the component will render the current month. If you want to change the starting month, you can set the `year` and `month` props. From 31d01a4a31ae7b3c6039936d881b5d81df612457 Mon Sep 17 00:00:00 2001 From: Josh Torres Date: Tue, 19 Mar 2024 08:39:41 -0700 Subject: [PATCH 3/3] - fix bug where number of weeks and days was counting incorrectly --- src/LivewireCalendar.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LivewireCalendar.php b/src/LivewireCalendar.php index 672af25..1204a8d 100755 --- a/src/LivewireCalendar.php +++ b/src/LivewireCalendar.php @@ -175,8 +175,8 @@ public function monthGrid() $firstDayOfGrid = $this->gridStartsAt; $lastDayOfGrid = $this->gridEndsAt; - $numbersOfWeeks = $lastDayOfGrid->diffInWeeks($firstDayOfGrid) + 1; - $days = $lastDayOfGrid->diffInDays($firstDayOfGrid) + 1; + $numbersOfWeeks = floor(abs($lastDayOfGrid->diffInWeeks($firstDayOfGrid)) + 1); + $days = floor(abs($lastDayOfGrid->diffInDays($firstDayOfGrid)) + 1); if ($days % 7 != 0) { throw new Exception("Livewire Calendar not correctly configured. Check initial inputs.");