From 0af259de4b199a66a420436f9820b749af83bebd Mon Sep 17 00:00:00 2001 From: xulongtai Date: Mon, 15 Aug 2022 14:52:15 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20'=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=9C=88=E4=BB=BD=E6=9C=80=E5=90=8E=E4=B8=80=E5=A4=A9=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E5=8F=AF=E8=AF=BB=E6=80=A7=5F0815'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/date-util.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) 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) {