Answers for "moment get date by weeknumber"

3

moment get weekday name

var m = moment().day(); // gives 4 for thursday, then you can do a switch
Posted by: Guest on January-14-2021
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
-2

moment get date by weeknumber

console.log(state.weeknumber)
    console.log(state.created_at.clone().add(7, "day").format("Do MMMM"))
    console.log(state.weeknumber)
    console.log(moment().day("monday").week(value).format("Do MMMM"))
    console.log(moment().day("tuesday").week(value).format("Do MMMM"))
    console.log(moment().day("wednesday").week(value).format("Do MMMM"))
    console.log(moment().day("thursday").week(value).format("Do MMMM"))
    console.log(moment().day("friday").week(value).format("Do MMMM"))
    console.log(moment().day("saturday").week(value).format("Do MMMM"))
    console.log(moment().day("sunday").week(value).add(7, "day").format("Do MMMM"))
Posted by: Guest on November-27-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language