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); };