Answers for "add 3 months to a date node js"

2

javascript date 3 months ago

var d = new Date();
d.setMonth(d.getMonth() - 3);
Posted by: Guest on May-04-2020
1

add one month to date javascript

// d - is a moment() call
addOneMonth: function (d) {
    let fm = moment(d).add(1, 'M');
    let fmEnd = moment(fm).endOf('month');
    return d.date() != fm.date() && fm.isSame(fmEnd.format('YYYY-MM-DD')) ? fm.add(1, 'd') : fm;
};
Posted by: Guest on June-22-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language