I'm using Maddhatter fullcalendar composer. And I want to make input that allow you to go to specific date.
I just search in fullcalendar.io and I found gotoDate
function. How can I use that function on laravel? or is there any solution to make this happen?
There is no need to do it in Laravel at all...Laravel/PHP code runs server-side. The Laravel code just renders some HTML and JavaScript into the browser to get fullCalendar to work. Therefore you can do this entirely client-side using JavaScript, and disregard the Laravel part. The only thing you need to take note of from your PHP code is the ID you give to the calendar - replace the calendar
ID in my code below with the ID you've used.
HTML:
Date: <input type="date" id="dateField"/>
<button type="button" id="dateBtn">Go to date</button>
JavaScript:
$("#dateBtn").click(function(){
$("#calendar").fullCalendar("gotoDate", $("#dateField").val());
});
See http://jsfiddle.net/sbxpv25p/826/ for a working demo.
you need to turn the date into a fullcalendar.moment object
for example:
let d = $.fullCalendar.moment(dateString);
$('#calendar').fullCalendar('gotoDate', d);
I assume you are familiar with jquery, if you are not please let me know and I shall assist you further!