Skip to content

Instantly share code, notes, and snippets.

@hugodias
Created March 7, 2013 12:31
Show Gist options
  • Save hugodias/5107717 to your computer and use it in GitHub Desktop.
Save hugodias/5107717 to your computer and use it in GitHub Desktop.
Datepicker no WeekendsOrMondays
$(document).ready(function() {
// Apenas dias a partir do dia atual poderão ser escolhidos
var dateMin = new Date();
// Função para bloquear finais de semana e segunda-feira
function noWeekendsOrMondays(date) {
var day = date.getDay();
// Remove finais de semana do calendário
var noWeekend = $.datepicker.noWeekends(date);
// Remove segunda feira do calendário
if( day == 1 ){
return false;
} else {
return noWeekend;
}
}
$('.datepicker').datepicker(
{
inline: true,
beforeShowDay: noWeekendsOrMondays,
dateFormat: "dd/mm/yy",
firstDay: 1,
dayNamesMin: ["Dom","Seg", "Ter", "Qua", "Qui", "Sex", "Sab" ],
monthNames: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
changeFirstDay: false,
minDate: dateMin
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment