mirror of https://github.com/ElemeFE/element
parent
acfc93a71f
commit
71268c5bab
|
@ -48,19 +48,9 @@ export const parseDate = function(string, format) {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDayCountOfMonth = function(year, month) {
|
export const getDayCountOfMonth = function(year, month) {
|
||||||
if (month === 3 || month === 5 || month === 8 || month === 10) {
|
if (isNaN(+month)) return 31;
|
||||||
return 30;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (month === 1) {
|
return new Date(year, +month + 1, 0).getDate();
|
||||||
if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
|
|
||||||
return 29;
|
|
||||||
} else {
|
|
||||||
return 28;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 31;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDayCountOfYear = function(year) {
|
export const getDayCountOfYear = function(year) {
|
||||||
|
|
Loading…
Reference in New Issue