var yugi = function (now) {
var d = new Date(now.replace(/[^\d]/g, "/") + "/1");
var result = [now];
for(var i = 0; i < 11; i++) {
d.setMonth(d.getMonth() - 1);
var m = d.getMonth() + 1;
m = m < 10 ? "0" + m : m;
result.push(d.getFullYear() + "-" + m);
}
return result;
}
yugi("2015-08");
温馨提示:答案为网友推荐,仅供参考