Created
March 7, 2013 12:31
-
-
Save hugodias/5107717 to your computer and use it in GitHub Desktop.
Datepicker no WeekendsOrMondays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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