const moment = require('moment'); // need to install run - npm run moment
const orderingDate = '2022-09-14T16:19:38.212+00:00';
const format = 'YYYY-MM-DD H:mm:ss';
const currentDate = moment(new Date()).format(format);
const recevingDate = moment(new Date(orderingDate)).format(format);
const differ = new Date(recevingDate) - new Date(currentDate);
let days = parseInt(differ / (1000 * 60 * 60 * 24)); //
let hours = parseInt(differ / (1000 * 60 * 60)); //
let min = parseInt(differ / (1000 * 60)); //
console.log('days', days, 'hours', hours, 'min', min);
var date1 = new Date("08/09/2017");
var date2 = new Date("08/10/2017");
var diffDays = parseInt((date2 - date1) / (1000 * 60 * 60 * 24)); //gives day difference
//one_day means 1000*60*60*24
//one_hour means 1000*60*60
//one_minute means 1000*60
//one_second means 1000
console.log(diffDays)