Answers for "javascript date set month over 11"

11

javascript get current month start and end date

var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
Posted by: Guest on May-02-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 date set month over 11"

Code answers related to "Javascript"

Browse Popular Code Answers by Language