<script lang="ts">
	import FullCalendar from '$lib/components/FullCalendar.svelte';
	import daygridPlugin from '@fullcalendar/daygrid';
	// import timegridPlugin from '@fullcalendar/timegrid';
	// import interactionPlugin from '@fullcalendar/interaction';
	let calendarRef;
	export let events
	export let options = {
		initialView: 'dayGridMonth',
		plugins: [daygridPlugin],
		locale: 'th',
        headerToolbar: {
			start: 'prev,next',
			center: 'title'
		},
        contentHeight:"auto",
        selectable: true,
        buttonText: {
            month: 'เดือน', 
            agendaDay: 'วัน', 
            agendaWeek: 'สัปดาห์', 
            today: 'วันนี้'
        },
		events,
		dateClick: clickDate,
	};
	function clickDate(info: { dateStr: string; }){
		alert('a day has been clicked!'+info.dateStr);
	}	
</script>
<FullCalendar bind:this={calendarRef} {options} />