I have the following code, my question is: How can I limit so that the date is only 7 days backwards or 7 days ahead?
$(document).ready(function() {
$('#fecha1').datepicker({
startDate: '2015-12-01',
format: 'YYYY-MM-DD'
});
$('#fecha1').datepicker().on('changeDate', function(e) {
fInicial = getFormattedDate('fecha1');
$(this).datepicker('hide');
});
$('#fecha2').datepicker().on('changeDate', function(e) {
fFinal = getFormattedDate('fecha2');
$(this).datepicker('hide');
var jqxhr = $.post({
url: 'assets/lib/infos.php',
data: {
inicio: fInicial,
fin: fFinal
},
dataType: "JSON"
})
.done(function(json) {
//codigo
})
});
});
as well as in this example: