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
You could use _.times helper from lodash alongside moment like so:
var daysInMonth = [];
var monthDate = moment().startOf('month'); // change to a date in the month of interest
_.times(monthDate.daysInMonth(), function (n) {
daysInMonth.push(monthDate.format('DD-ffffd')); // your format
monthDate.add(1, 'day');
});
console.log(daysInMonth)