Utils: update date-util.js (#22099)

Co-authored-by: xulongtai <xulongtai@ganguo.hk>
pull/22148/head
Due07 2022-09-13 14:40:27 +08:00 committed by GitHub
parent acfc93a71f
commit 71268c5bab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 12 deletions

View File

@ -48,19 +48,9 @@ export const parseDate = function(string, format) {
};
export const getDayCountOfMonth = function(year, month) {
if (month === 3 || month === 5 || month === 8 || month === 10) {
return 30;
}
if (isNaN(+month)) return 31;
if (month === 1) {
if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
return 29;
} else {
return 28;
}
}
return 31;
return new Date(year, +month + 1, 0).getDate();
};
export const getDayCountOfYear = function(year) {