Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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;
};
Source by w3programmers.org #
 
PREVIOUS NEXT
Tagged: #add #month #date #javascript
ADD COMMENT
Topic
Name
8+2 =