From 7ff1c2d8c79a9fc04345e0bbc0b1d2a2ec20561c Mon Sep 17 00:00:00 2001 From: "Oliver.Ke" Date: Thu, 31 Aug 2023 17:18:58 +0800 Subject: [PATCH] =?UTF-8?q?BI-133009=20fix:=20=E5=AD=A3=E6=9C=AB=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E8=AE=A1=E7=AE=97=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/core/func/date.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/fineui/src/core/func/date.js b/packages/fineui/src/core/func/date.js index b592ad7d7..599e006c7 100644 --- a/packages/fineui/src/core/func/date.js +++ b/packages/fineui/src/core/func/date.js @@ -56,7 +56,7 @@ export function getMonthDays(date, month = date.getMonth()) { if (((0 === (year % 4)) && ((0 !== (year % 100)) || (0 === (year % 400)))) && month === 1) { return 29; } - + return _MD[month]; } @@ -85,7 +85,7 @@ export function getDayOfYear(date) { const now = getDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); const then = getDate(date.getFullYear(), 0, 0, 0, 0, 0); const time = now - then; - + return Math.floor(time / DAY); } @@ -108,7 +108,7 @@ export function getWeekNumber(date) { const ms = d.valueOf(); d.setMonth(0); d.setDate(1); - + return Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; } @@ -135,7 +135,7 @@ export function getOffsetQuarter(date, n) { } dt.setDate(day); dt.setMonth(dt.getMonth() + parseInt(n, 10) * 3); - + return dt; } @@ -159,7 +159,7 @@ export function getQuarterStartMonth(date) { if (nowMonth > 8) { quarterStartMonth = 9; } - + return quarterStartMonth; } @@ -179,8 +179,8 @@ export function getQuarterStartDate(date) { */ export function getQuarterEndDate(date) { const quarterEndMonth = getQuarterStartMonth(date) + 2; - - return getDate(date.getFullYear(), quarterEndMonth, getMonthDays(date)); + + return getDate(date.getFullYear(), quarterEndMonth, getMonthDays(date, quarterEndMonth)); } /** @@ -198,7 +198,7 @@ export function getOffsetMonth(date, n) { } dt.setDate(day); dt.setMonth(dt.getMonth() + parseInt(n, 10)); - + return dt; } @@ -210,7 +210,7 @@ export function getOffsetMonth(date, n) { export function getWeekStartDate(date) { const w = date.getDay(); const startOfWeek = StartOfWeek % 7; - + return getOffsetDate(date, _OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)]); } @@ -222,7 +222,7 @@ export function getWeekStartDate(date) { export function getWeekEndDate(date) { const w = date.getDay(); const startOfWeek = StartOfWeek % 7; - + return getOffsetDate(date, _OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)] + 6); } @@ -349,7 +349,7 @@ export function print(date, str) { if (!_global.navigator) { return false; } - + return /Konqueror|Safari|KHTML/i.test(navigator.userAgent); };