Answers for "moment get list of dates by week number"

0

moment get list of dates by week number

var dateformat = "YYYY/MM/DD";
function getWeekDaysByWeekNumber(weeknumber)
{
    var date = moment().isoWeek(weeknumber||1).startOf("week"), weeklength=7, result=[];
    while(weeklength--)
    {
        result.push(date.format(dateformat));
        date.add(1,"day")
    }
    return result;
}

console.log(getWeekDaysByWeekNumber())
console.log(getWeekDaysByWeekNumber(2))
console.log(getWeekDaysByWeekNumber(25))
Posted by: Guest on November-22-2020

Code answers related to "moment get list of dates by week number"

Code answers related to "Javascript"

Browse Popular Code Answers by Language