jQuery(document).ready(function ($) {
var dateToday = new Date();
$( function() {
$( "#inicio" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat:'dd-M-yy',
minDate: dateToday,
onClose: function (selected) {
if(selected.length < 0) {
// selected is empty
$("#final").datepicker('disable');
} else {
$("#final").datepicker('enable');
}
var dateb = $('#inicio').datepicker('getDate');
dateb.setDate(dateb.getDate() + 1);
$("#final").datepicker("option", "minDate", dateb);
}
});
$( "#final" ).datepicker({
changeMonth: true,
changeYear: true,
minDate: '',
dateFormat:'dd-M-yy',
onClose: function (selected) {
if(selected.length <= 0) {
// selected is empty
$("#inicio").datepicker('disable');
} else {
$("#inicio").datepicker('enable');
}
$("#inicio").datepicker("option", "maxDate", selected);
}
});
$.datepicker.regional[ "es" ] = {
closeText: "Hecho",
prevText: "Ant",
nextText: "Sig",
currentText: "Hoy",
monthNames: [ "Enero","Febrero","Marzo","Abril","Mayo","Junio",
"Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre" ],
monthNamesShort: [ "Ene", "Feb", "Mar", "Abr", "May", "Jun",
"Jul", "Ago", "Sep", "Oct", "Nov", "Dic" ],
dayNames: [ "Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado" ],
dayNamesShort: [ "Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab" ],
dayNamesMin: [ "Do","Lu","Ma","Mi","Ju","Vi","Sa" ],
weekHeader: "Se",
dateFormat: "dd/mm/yy",
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: "" };
$.datepicker.setDefaults( $.datepicker.regional[ "es" ] );
});
});