Unsure if this is a viable solution to your issue. Could you use a combination of moment.js and underscore.js?
var days = [...]// your array of dates.
var filtered = _.uniq(days, function(item) {
return moment(item).format("YYYY MM");
});
console.log(filtered); => array containing one day per month.
This will return the first day of each month.