function addDay(dayInterval, date) {
date = date ? date : new Date();
var ms = dayInterval * (1000 * 60 * 60 * 24)
return new Date(date.getTime() + ms);
}
function formatDate(date) {
var day = date.getDate() > 9 ?
date.getDate() :
"0" + date.getDate();
var month = (date.getMonth() + 1) > 9 ?
(date.getMonth() + 1) :
"0" + (date.getMonth() + 1);
return date.getFullYear() + '-' + month + '-' + day;
}