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

Fix for: Exception Livewire Calendar not correctly configured. Check initial inputs. #13

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 31 additions & 26 deletions src/LivewireCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,25 @@ class LivewireCalendar extends Component
'gridEndsAt' => 'date',
];

public function mount($initialYear = null,
$initialMonth = null,
$weekStartsAt = null,
$calendarView = null,
$dayView = null,
$eventView = null,
$dayOfWeekView = null,
$dragAndDropClasses = null,
$beforeCalendarView = null,
$afterCalendarView = null,
$pollMillis = null,
$pollAction = null,
$dragAndDropEnabled = true,
$dayClickEnabled = true,
$eventClickEnabled = true,
$extras = [])
{
public function mount(
$initialYear = null,
$initialMonth = null,
$weekStartsAt = null,
$calendarView = null,
$dayView = null,
$eventView = null,
$dayOfWeekView = null,
$dragAndDropClasses = null,
$beforeCalendarView = null,
$afterCalendarView = null,
$pollMillis = null,
$pollAction = null,
$dragAndDropEnabled = true,
$dayClickEnabled = true,
$eventClickEnabled = true,
$extras = []

) {
$this->weekStartsAt = $weekStartsAt ?? Carbon::SUNDAY;
$this->weekEndsAt = $this->weekStartsAt == Carbon::SUNDAY
? Carbon::SATURDAY
Expand Down Expand Up @@ -115,13 +117,14 @@ public function afterMount($extras = [])
//
}

public function setupViews($calendarView = null,
$dayView = null,
$eventView = null,
$dayOfWeekView = null,
$beforeCalendarView = null,
$afterCalendarView = null)
{
public function setupViews(
$calendarView = null,
$dayView = null,
$eventView = null,
$dayOfWeekView = null,
$beforeCalendarView = null,
$afterCalendarView = null
) {
$this->calendarView = $calendarView ?? 'livewire-calendar::calendar';
$this->dayView = $dayView ?? 'livewire-calendar::day';
$this->eventView = $eventView ?? 'livewire-calendar::event';
Expand All @@ -140,15 +143,17 @@ public function setupPoll($pollMillis, $pollAction)
public function goToPreviousMonth()
{
$this->startsAt->subMonthNoOverflow();
$this->endsAt->subMonthNoOverflow();
// $this->endsAt->subMonthNoOverflow();
$this->endsAt = $this->startsAt->clone()->endOfMonth()->startOfDay();

$this->calculateGridStartsEnds();
}

public function goToNextMonth()
{
$this->startsAt->addMonthNoOverflow();
$this->endsAt->addMonthNoOverflow();
// $this->endsAt->addMonthNoOverflow();
$this->endsAt = $this->startsAt->clone()->endOfMonth()->startOfDay();

$this->calculateGridStartsEnds();
}
Expand Down