I am just a hobby player, and I have a little trouble with the DateTimePicker available time listing. I am looking for help to understand why is the codes are not working. I am not building any websites or like that, I am just practising.
Basic:
<script>
$('#datetimepicker4').datetimepicker({
minDate:new Date(),
allowTimes:['10:30','11:30','12:30'] });
</script>
Those 3 allowed times listed perfectly.
My question is just a principal: Why is it not working like this?
Only example:
$time1 = "10:30";
$time2 = "11:30";
$time3 = "12:30";
$list = "'" . $time2 . "'," . $time3 . "'";
echo "<script>\n";
echo "$('#datetimepicker4').datetimepicker({ minDate:new Date(), allowTimes:[".json_encode($list)."] });";
echo "\n</script>";
If I am print out the "$list" php variable, it will be showing:'11:30','12:30'. But in the js showing only 1 allowed time rather than 2. Actually it can be 10 different times, still showing only 1.
I can't see the difference between the two ways of listing.
If you can give me an answer I will appreciated.
Thank you.