<input id="calendario" type="text" class="date-picker form-control2" name="calendario" placeholder="Data da consulta" />
<label for="calendario" class="input-group-addon2 btn" style="margin: -3px 0 0 -4px;"><span class="glyphicon glyphicon-calendar"></span> </label>
<script type="text/javascript">
/** O dia que gostaria de desabilitar no calendário */
var disableddates = ["5-6-2015", "7-7-2015", "8-8-2015", "13-7-2015"];
function DisableSpecificDates(date) {
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
// Formato da desabilitada dd-mm-yyyy
var currentdate = d + '-' + (m + 1) + '-' + y ;
// Vamos agora verificar se a data pertence a disableddates matriz
for (var i = 0; i < disableddates.length; i++) {
// Agora, verifique quais datas existem na matriz datas e ativa no calendário.
if ($.inArray(currentdate, disableddates) != -1 ) {
return [true];
} else {
return [false];
}
}
// No caso de a data não está presente na matriz deficientes , vamos agora verificar se é um fim de semana .
// com a função noWeekends
var weekenddate = $.datepicker.noWeekends(date);
return weekenddate;
}
$(function() {
$( "#calendario" ).datepicker({
beforeShowDay: DisableSpecificDates,
minDate: 0,
dateFormat: 'dd/mm/yy',
//validação da data caso preenchimento errado ou vázio
onSelect: function (calendario, inst) {
$('#calendario').text(this.value);
$('#defaultForm').bootstrapValidator('revalidateField', 'calendario');
},
// tradução do calendário
dayNames:...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.