moment("20111031", "YYYYMMDD").fromNow(); // há 9 anos
moment("20120620", "YYYYMMDD").fromNow(); // há 8 anos
moment().startOf('day').fromNow(); // há 13 horas
moment().endOf('day').fromNow(); // em 11 horas
moment().startOf('hour').fromNow(); // há 10 minutos
moment("20111031", "YYYYMMDD").fromNow(); // 11 years ago
moment("20120620", "YYYYMMDD").fromNow(); // 10 years ago
moment().startOf('day').fromNow(); // 14 hours ago
moment().endOf('day').fromNow(); // in 10 hours
moment().startOf('hour').fromNow(); // 24 minutes ago
moment("20111031", "YYYYMMDD").fromNow(); // 11 years ago
moment("20120620", "YYYYMMDD").fromNow(); // 10 years ago
moment().startOf('day')
// 11 hours ago
moment().endOf('day').fromNow(); // in 13 hours
moment().startOf('hour').fromNow(); // 19 minutes ago
/*
// https://momentjs.com/docs/
We now generally consider Moment to be a legacy project in maintenance mode.
It is not dead, but it is indeed done.
In practice, this means:
We will not be adding new features or capabilities.
We will not be changing Moment's API to be immutable.
We will not be addressing tree shaking or bundle size issues.
We will not be making any major changes (no version 3).
We may choose to not fix bugs or behavioral quirks,
especially if they are long-standing known issues.
Here are the alternatives we recommend:{
"luxon":"https://moment.github.io/luxon/",
"day.js":"https://day.js.org/",
"date-fns":"https://date-fns.org/",
"js-joda":"https://js-joda.github.io/js-joda/",
"No Library":"JavaScript has always had a Date object, defined ECMAScript (ECMA-262) specification",
}
*/
moment("20111031", "YYYYMMDD").fromNow(); // 11 years ago
moment("20120620", "YYYYMMDD").fromNow(); // 10 years ago
moment().startOf('day').fromNow(); // 20 hours ago
moment().endOf('day').fromNow(); // in 4 hours
moment().startOf('hour').fromNow(); // 10 minutes ago
moment().format('YYYY-MM-DD');// FECHA DE ACTUAL: 2022-12-04
moment().format('DD-MM-YYYY');// FECHA DE ACTUAL: 04-12-2022
moment('2022-12-12').add(10, 'days').format('DD-MM-YYYY');//SUMA 10 DIAS: 22-12-2022