I'm trying to use the bootstrap-year-calendar and I'm not able to pass the values in the correct way.
I have an array with the data in this way:
<?php
$data = array(
array(
"startDate" => "2016-1-4",
"endDate" => "2016-1-4"
),
array(
"startDate" => "2016-1-8",
"endDate" => "2016-1-8"
),
array(
"startDate" => "2016-1-16",
"endDate" => "2016-1-16"
)
);
?>
but I have to do something like this:
<?php // I have here my $data array ?>
<div id="calendar"></div>
<script>
$(function() {
$('#calendar').calendar({
dataSource: [
{
startDate: new Date(2016, 1, 4),
endDate: new Date(2016, 1, 4)
},
{
startDate: new Date(2016, 1, 8),
endDate: new Date(2016, 1, 8)
}
,
{
startDate: new Date(2016, 1, 16),
endDate: new Date(2016, 1, 16)
}
]
});
});
</script>
How can I pass my $data array to the 'datasource' variable?