Commit 71268c5b authored by Due07's avatar Due07 Committed by GitHub

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

Co-authored-by: default avatarxulongtai <xulongtai@ganguo.hk>
parent acfc93a7
...@@ -48,19 +48,9 @@ export const parseDate = function(string, format) { ...@@ -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) {
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) { export const getDayCountOfYear = function(year) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment