Generate date from week number in moment.js

Try like this:-

var weekdate= function(year, week, dayNumber)
{
    var j1 = new Date( year,0,10,12,0,0),
        j2 = new Date( year,0,4,12,0,0),
        mon1 = j2.getTime() - j1.getDay() * 86400000;
    return new Date(mon1 + ((week- 1)  * 7  + dayNumber) * 86400000);
};
console.log(weekdate(2010, 1, 4));

2010 starts with Thursady


Sorry found solution myself:

var test = moment().day("Monday").week(week number here);

Building off the answers provided here...

exports.getDateFromWeek = function(week, year) {
    return moment().day("Monday").year(year).week(week).toDate();
};

Personally, I wanted the first Sunday... and in which case it's:

exports.getDateFromWeek = function(week, year) {
    return moment().day("Sunday").year(year).week(week).toDate();
};