JSFiddle - React, Tailwind, and code Playground
by Alpesh Patel
JavaScript
//work out number of days between the two dates
var oneDay = 24 * 60 * 60 * 1000;
//var date1 = new Date("2014,08,31");
//var date2 = new Date("2014,08,19");
var date1 = new Date("2014-08-31");
var date2 = new Date("2014-08-19");
var Daysd = date1.getDate() - date2.getDate();
//var days_between = date1 - date2
var diffDays = Math.round(Math.abs((date1.getTime() - date2.getTime()) / (oneDay)));
//do the cost per month times 12 (months)
var year_cost = parseInt(2.60) * 12
alert(Daysd);
alert(year_cost);