I\'m writing an equipment rental application where clients are charged a fee for renting equipment based on the duration (in days) of the rental. So, basically, (daily fee *
I know this is a partial solution but you may be able to get the days between dates (as long as the dates don't have time set). Then you can work from there.
I'm basing this solution with the problem you presented ((daily fee * number of days) = total charge); not the actual date difference question. This should help you out.
var Main = function() {
var startDate = new Date('08/20/2014');
var endDate = new Date('08/22/2014');
var totalCharge = monthlyFee * daysBetween(startDate, endDate);
}
var daysBetween = function(startDate, endDate) {
return Math.round(Math.abs((startDate.getTime() - endDate.getTime())/(24*60*60*1000)));
};