Come da titolo vi chiedo se qualcuno di voi sa come impostare il datepiker in modo tale da poter selezionare oltre che ad esempio tutte le domeniche ( cosa che sono riuscito a fare ) anche alcuni giorni spuri, contenui ad esempio in un array )
Ho fatto, aiutandomi con un esempio, una cosa del genere, che non funziona totalmnte però.. Qualche idea?
Grazie in anticipo.
Ho fatto, aiutandomi con un esempio, una cosa del genere, che non funziona totalmnte però.. Qualche idea?
HTML:
/* Datapiker */
jQuery(document).ready(function ($) {
//Data di oggi e setto inizio primo datepiker
var now = new Date();
var today = now.getDate() + '/' + (now.getMonth() + 1) + '/' + now.getFullYear();
$('#datepicker').val(today);
});
/* Datapiker 1 */
jQuery(document).ready(function ($) {
//Data di domani e setto inizio secondo datepiker
var now = new Date();
var today = now.getDate() + 1 + '/' + (now.getMonth() + 1) + '/' + now.getFullYear();
$('#datepicker1').val(today);
});
// DA QUI IN POI NON VA COME SPERATO
/* Datapiker format*/
var availableDates = [
new Date(2017, 7, 12),
new Date(2017, 7, 27),
new Date(2017, 7, 14)
];
function available(date) {
if (date.getDay() === 0 && $.inArray(date.getDay(), availableDates)) {
return [true, ""];
} else {
return [false, "", "Unavailable"];
}
}
jQuery(document).ready(function ($) {
// Setter
$("#datepicker, #datepicker1").datepicker({
beforeShowDay: available,
"dateFormat": "dd/mm/yy",
"showAnim": "slideDown",
"showButtonPanel": true,
"firstDay": 1,
"minDate": 0
});
});
jQuery(document).ready(function ($) {
$("#datepicker").change(function(){
//Aggiungo 3gg alla data selezionata
var currentDate = $(this).datepicker('getDate');
currentDate.setDate(currentDate.getDate() + 7);
$("#datepicker1").datepicker('setDate', currentDate);
$("#datepicker1").datepicker( "destroy" ); //distruggo
$("#datepicker1").datepicker({ beforeShowDay: function (dt) {return [dt.getDay() == 0, ""];},minDate: currentDate, maxDate: "", dateFormat: "dd/mm/yy", showButtonPanel: true, "firstDay": 1 });//reinizializzo con range data
});//CHANGE
});