//.....Add 1 month From Selected Date
AddMonthToDate: function (selectedDate, month) {
var date = new Date(selectedDate);
var currentDate = date.getDate();
date.setDate(month);
date.setMonth(date.getMonth() + month);
var daysInMonth = new Date(date.getYear(), date.getMonth() + month, 0).getDate();
date.setDate(Math.min(currentDate, daysInMonth));
return date;
},
//...Add 30 Days From Selected Date
AddDaysToDate: function (selectedDate, days) {
var x = selectedDate.getDate();
var m1 = selectedDate.getMonth();
selectedDate.setDate(selectedDate.getDate() + days);
var m2 = selectedDate.getMonth();
if (m1 == m2) {
selectedDate.setDate(selectedDate.getDate() + 1);
}
return new Date(selectedDate);
}
AddMonthToDate: function (selectedDate, month) {
var date = new Date(selectedDate);
var currentDate = date.getDate();
date.setDate(month);
date.setMonth(date.getMonth() + month);
var daysInMonth = new Date(date.getYear(), date.getMonth() + month, 0).getDate();
date.setDate(Math.min(currentDate, daysInMonth));
return date;
},
//...Add 30 Days From Selected Date
AddDaysToDate: function (selectedDate, days) {
var x = selectedDate.getDate();
var m1 = selectedDate.getMonth();
selectedDate.setDate(selectedDate.getDate() + days);
var m2 = selectedDate.getMonth();
if (m1 == m2) {
selectedDate.setDate(selectedDate.getDate() + 1);
}
return new Date(selectedDate);
}
0 Comments