Using Moment.js I would like to get all days in a month of specific year in an array. For example:
January-2014: [ \"01-wed\", \"02-thr\", \"03-fri\", \"04-s
Alternatively you might now use moment range to achieve this :
const month = moment('2012-02', 'YYYY-MM'); const range = moment().range(moment(month).startOf('month'), moment(month).endOf('month')); const days = range.by('days'); console.log([...days].map(date => date.format('DD-ffffd')));