Skip to content

Commit

Permalink
Merge pull request #37 from omnia-digital/dev
Browse files Browse the repository at this point in the history
3.1.2
  • Loading branch information
joshtorres authored Oct 18, 2024
2 parents b7cb400 + 07d9d01 commit bd8d943
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,26 @@ Example
This will render a calendar grid.

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.
starting month, you can set the `initialYear` and `initialMonth` props.

Example

```blade
<livewire:appointments-calendar
year="2019"
month="12"
initialYear="2019"
initialMonth="12"
/>
```

If you use it as a nested component, you can use variables and make it dynamic (:key prop will force livewire to re-render calendar).

Example

```blade
<livewire:appointments-calendar
initialYear="{{ $currentYear }}"
initialMonth="{{ $currentMonth }}"
:key="$currentYear.$currentMonth"
/>
```

Expand Down
4 changes: 2 additions & 2 deletions src/LivewireCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ public function goToCurrentMonth()

public function calculateGridStartsEnds()
{
$this->gridStartsAt = $this->startsAt->clone()->startOfWeek($this->weekStartsAt);
$this->gridEndsAt = $this->endsAt->clone()->endOfWeek($this->weekEndsAt);
$this->gridStartsAt = $this->startsAt->clone()->startOfWeek($this->weekStartsAt)->shiftTimezone(config('app.timezone'));;
$this->gridEndsAt = $this->endsAt->clone()->endOfWeek($this->weekEndsAt)->shiftTimezone(config('app.timezone'));;
}

/**
Expand Down

0 comments on commit bd8d943

Please sign in to comment.