//计算某月1号是星期几
var getWeekInMonth = function(year, month) {
return new Date(year + ‘/’ + month + ‘/’ + ’01’).getDay();
}
//计算某年某月有多少天
var isLeapYear = function(a) {
return a % 400 == 0 || a % 4 == 0 && a % 100 != 0
}
var getDaysInMonth = function(a, b) {
return [null, 31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][b] || (isLeapYear(a) ? 29 : 28)
};
转载于:https://www.cnblogs.com/miumiu316/p/7210731.html