Skip to content

Commit

Permalink
Merge pull request #27 from omnia-digital/dev
Browse files Browse the repository at this point in the history
Release 3.1.1
  • Loading branch information
joshtorres authored Mar 19, 2024
2 parents 586f78b + 31d01a4 commit b7cb400
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -119,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.

Expand Down
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 b7cb400

Please sign in to comment.