error draw calendar
fferraro87 opened this issue · 1 comments
Hi,
i'm trying to draw simple calendar with this code :
<?php $calendar = new Calendar(); echo $calendar->draw(date('d-m-Y')); ?>
but i've that error :
Fatal error: Uncaught Error: Call to a member function modify() on boolean in C:\xampp3\htdocs\zimbra_admin\vendor\benhall14\php-calendar\src\phpCalendar\Calendar.php:138 Stack trace: #0 C:\xampp3\htdocs\zimbra_admin\contatore.php(20): benhall14\phpCalendar\Calendar->draw(false) #1 {main} thrown in C:\xampp3\htdocs\zimbra_admin\vendor\benhall14\php-calendar\src\phpCalendar\Calendar.php on line 138
how can i fix?
From the code posted, it looks like your using the wrong date format to draw the calendar. It must be in Y-m-d format, but you're using d-m-Y.
Thanks for flagging this - I'll try and get some validation added in a future release to allow other date formats. In the meantime, it should work if you swap:
echo $calendar->draw(date('d-m-Y'));
with
echo $calendar->draw(date('Y-m-d'));