Answers for "moment js subtract 1 month"

1

moment js subtract years

let min_date = moment().subtract(18, 'years');
Posted by: Guest on November-19-2020
0

moment js get date 1 month

var currentDate = moment('2015-10-30');
var futureMonth = moment(currentDate).add(1, 'M');
var futureMonthEnd = moment(futureMonth).endOf('month');

if(currentDate.date() != futureMonth.date() && futureMonth.isSame(futureMonthEnd.format('YYYY-MM-DD'))) {
    futureMonth = futureMonth.add(1, 'd');
}

console.log(currentDate);
console.log(futureMonth);
Posted by: Guest on April-21-2020
0

moment(endDate).subtract(1, 'month')

moment().subtract(7, 'days');
Posted by: Guest on March-31-2021
0

moment.js format

moment("20111031", "YYYYMMDD").fromNow(); // 9 years ago
moment("20120620", "YYYYMMDD").fromNow(); // 8 years ago
moment().startOf('day').fromNow();        // 13 hours ago
moment().endOf('day').fromNow();          // in 11 hours
moment().startOf('hour').fromNow();       // 4 minutes ago
Posted by: Guest on December-04-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language