moment.week() code example

Example 1: moment get day

var check = moment(n.entry.date_entered, 'YYYY/MM/DD');

var month = check.format('M');
var day   = check.format('D');
var year  = check.format('YYYY');

Example 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"))

Tags:

Misc Example