var endDate = moment('02-05-2022', 'DD-MM-YYYY'); var dayDiff = endDate.diff(startDate, 'days'); console.log('Days:' + dayDiff); var monthDiff = endDate.diff(startDate, 'months'); console.log('Month:' + monthDiff); var yearDiff = endDate.diff(startDate, 'years'); console.log('Year:' + yearDiff); .