Skip to content

Commit

Permalink
- fix bug where number of weeks and days was counting incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtorres committed Mar 19, 2024
1 parent 58d6877 commit 31d01a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/LivewireCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down

0 comments on commit 31d01a4

Please sign in to comment.