0
My code does not show the dates selected in the calendar ,see I have an array of dates but does not show.
<script src="~/Scripts/jquery.js"></script>
<script src="~/Scripts/jquery-ui.js"></script>
<link href="~/Content/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript">
var $j = jQuery.noConflict();
var array = ["2015/05/03", "2015/05/13", "2015/05/23"];
$j("#Data").datepicker({
dateFormat: 'dd/mm/yy',
dayNames: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'],
dayNamesMin: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S', 'D'],
dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb', 'Dom'],
monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
nextText: 'Próximo',
prevText: 'Anterior',
beforeShowDay: function(date) {
if ($j.inArray($j.datepicker.formatDate('dd/mm/yy', date), array) > -1) {
return [false, "", "Booked out"];
} else {
return [true, '', "available"];
}
}
});
</script>
am now receiving dates in this format and be giving error ["2015-04-10T00:00:00","2015-04-11T00:00:00"]
– Hans Miller
@Hansmiller you mean the dates within
var array
are in this format and not in the format you put in the question?– Sergio
yes! would have to format them to stay in this module?
– Hans Miller
@Hansmiller yes, does so: https://jsfiddle.net/usrbo7fe/1/
– Sergio
face generates datepicker but does not highlight the dates on the calendar
– Hans Miller
@Hansmiller ok, so you can be clearer: where it comes from
array
? this is what you want: https://jsfiddle.net/usrbo7fe/2/ ?– Sergio