[Solved] how to get Difference between Two Dates in Javascript Year/Month/Day [duplicate]


date1 = new Date(date1.getUTCFullYear(), date1.getUTCMonth(), date1.getUTCDate(), date1.getUTCHours(), date1.getUTCMinutes(), date1.getUTCSeconds());
date2 = new Date(date2.getUTCFullYear(), date2.getUTCMonth(), date2.getUTCDate(), date2.getUTCHours(), date2.getUTCMinutes(), date2.getUTCSeconds());

let diff_ms = date2.getTime() - date1.getTime();
let diff = Math.round(diff_ms / (1000 * 60 * 60 * 24));

This will give you difference in no of days. You can then deduce year, month, days.

solved how to get Difference between Two Dates in Javascript Year/Month/Day [duplicate]