diff --git a/src/utils/date-util.js b/src/utils/date-util.js index 1828adfc22..9e8a2f4af6 100644 --- a/src/utils/date-util.js +++ b/src/utils/date-util.js @@ -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 (month === 1) { - if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) { - return 29; - } else { - return 28; - } - } + if (isNaN(+month)) return 31; - return 31; + return new Date(year, +month + 1, 0).getDate(); }; export const getDayCountOfYear = function(year) {