export const getMonthDayNum = function (year
= 2020,month
= 1) {
if(month
< 1 || month
> 12){
console
.log("参数不合法")
return
}
let num
= 28;
switch(month
){
case 1:
num
= 31;break;
case 2:
if(year
%4 == 0 || (year
% 400 == 0 && year
% 100 == 0)){
num
= 29
}else{
num
= 28
}
;break;
case 3:
num
= 31;break;
case 4:
num
= 30;break;
case 5:
num
= 31;break;
case 6:
num
= 30;break;
case 7:
num
= 31;break;
case 8:
num
= 31;break;
case 9:
num
= 30;break;
case 10:
num
= 31;break;
case 11:
num
= 30;break;
case 12:
num
= 31;break;
default:
num
= 28;break;
}
return num
;
}
转载请注明原文地址:https://tech.qufami.com/read-6155.html