I don't think you need to import a JS framework to do this.
You can compare Dates
in plain JavaScript.
const arrayOfDates = ["02/11/2019 11:22:28", "02/11/2020 11:22:28",
"04/03/2019 11:33:54"];
const TODAY = new Date();
const END_OF_TODAY = new Date(TODAY.getFullYear(), TODAY.getMonth(), TODAY.getDay(), 24, 59, 59);
const END_OF_TOMORROW = new Date(TODAY.getFullYear(), TODAY.getMonth(), TODAY.getDay() + 1, 24, 59, 59);
let datesBeforeToday = [];
let datesBetweenNowAndEndOfDate = [];
let datesWithTomorrowsDate = [];
for (var i=0; i<arrayOfDates.length; i++)
{
var dateInArray = new Date(arrayOfDates[i]);
// Before today
if (TODAY > dateInArray)
{
datesBeforeToday.push(dateInArray);
}
// between now - end of today
else if (END_OF_TODAY >= dateInArray)
{
datesBetweenNowAndEndOfDate.push(dateInArray);
}
// between end of today - end of tomorrow
else if (END_OF_TOMORROW >= dateInArray)
{
datesWithTomorrowsDate.push(dateInArray);
}
}
// 1) Number of dates before 'now'
console.log(datesBeforeToday.length);
// 2) Number of dates between 'now' and the end of the current date
console.log(datesBetweenNowAndEndOfDate.length);
// 3) Number of dates with tomorrow date
console.log(datesWithTomorrowsDate.length);