xxxxxxxxxx
const dateTimeAgo = moment("2021-10-03 07:35:53").fromNow();
console.log(dateTimeAgo); //
xxxxxxxxxx
const dateTimeAgo = moment("2020-04-04 11:45:26.123").fromNow();
console.log(dateTimeAgo); //> 6 minutes ago
xxxxxxxxxx
var currentDate = moment(); // Get the current date
var date30DaysAgo = currentDate.subtract(30, 'days'); // Subtract 30 days from the current date
console.log(date30DaysAgo.format('YYYY-MM-DD')); // Output the date in the desired format