JSFiddle - React, Tailwind, and code Playground

by Frank Liu

JavaScript

var date_diff_indays = function(date1, date2) {
dt1 = new Date(date1);
dt2 = new Date();
return Math.floor((Date.UTC(dt2.getFullYear(), dt2.getMonth(), dt2.getDate()) - Date.UTC(dt1.getFullYear(), dt1.getMonth(), dt1.getDate()) ) /(1000 * 60 * 60 * 24));
}
console.log(date_diff_indays('01 07 2020', ''));