diff --git a/src/PickerPanel/DecadePanel/index.tsx b/src/PickerPanel/DecadePanel/index.tsx index 78fba0c42..d57a067d5 100644 --- a/src/PickerPanel/DecadePanel/index.tsx +++ b/src/PickerPanel/DecadePanel/index.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import type { DisabledDate, SharedPanelProps } from '../../interface'; -import { formatValue, isSameDecade } from '../../utils/dateUtil'; +import { formatValue } from '../../utils/dateUtil'; import { PanelContext, useInfo } from '../context'; import PanelBody from '../PanelBody'; import PanelHeader from '../PanelHeader'; @@ -14,7 +14,7 @@ export default function DecadePanel( const panelPrefixCls = `${prefixCls}-decade-panel`; // ========================== Base ========================== - const [info, now] = useInfo(props, 'decade'); + const [info] = useInfo(props, 'decade'); const startYear = Math.floor(generateConfig.getYear(pickerValue) / 100) * 100; const endYear = startYear + 99; @@ -49,7 +49,6 @@ export default function DecadePanel( const dateYear = generateConfig.getYear(date); return { [`${prefixCls}-cell-in-view`]: startYear <= dateYear && dateYear <= endYear, - [`${prefixCls}-cell-today`]: isSameDecade(generateConfig, date, now), }; }; diff --git a/src/PickerPanel/MonthPanel/index.tsx b/src/PickerPanel/MonthPanel/index.tsx index 07aafd4f3..26421b2b6 100644 --- a/src/PickerPanel/MonthPanel/index.tsx +++ b/src/PickerPanel/MonthPanel/index.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import type { DisabledDate, SharedPanelProps } from '../../interface'; -import { formatValue, isSameMonth } from '../../utils/dateUtil'; +import { formatValue } from '../../utils/dateUtil'; import { PanelContext, useInfo } from '../context'; import PanelBody from '../PanelBody'; import PanelHeader from '../PanelHeader'; @@ -21,7 +21,7 @@ export default function MonthPanel( const panelPrefixCls = `${prefixCls}-month-panel`; // ========================== Base ========================== - const [info, now] = useInfo(props, 'month'); + const [info] = useInfo(props, 'month'); const baseDate = generateConfig.setMonth(pickerValue, 0); // ========================= Month ========================== @@ -48,9 +48,8 @@ export default function MonthPanel( : monthsLocale[month]; }; - const getCellClassName = (date: DateType) => ({ + const getCellClassName = () => ({ [`${prefixCls}-cell-in-view`]: true, - [`${prefixCls}-cell-today`]: isSameMonth(generateConfig, date, now), }); // ======================== Disabled ======================== diff --git a/src/PickerPanel/QuarterPanel/index.tsx b/src/PickerPanel/QuarterPanel/index.tsx index 1f13534b8..7e0da8f8f 100644 --- a/src/PickerPanel/QuarterPanel/index.tsx +++ b/src/PickerPanel/QuarterPanel/index.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import type { SharedPanelProps } from '../../interface'; -import { formatValue, isSameQuarter } from '../../utils/dateUtil'; +import { formatValue } from '../../utils/dateUtil'; import { PanelContext, useInfo } from '../context'; import PanelBody from '../PanelBody'; import PanelHeader from '../PanelHeader'; @@ -14,7 +14,7 @@ export default function QuarterPanel( const panelPrefixCls = `${prefixCls}-quarter-panel`; // ========================== Base ========================== - const [info, now] = useInfo(props, 'quarter'); + const [info] = useInfo(props, 'quarter'); const baseDate = generateConfig.setMonth(pickerValue, 0); // ========================= Cells ========================== @@ -30,9 +30,8 @@ export default function QuarterPanel( }); }; - const getCellClassName = (date: DateType) => ({ + const getCellClassName = () => ({ [`${prefixCls}-cell-in-view`]: true, - [`${prefixCls}-cell-today`]: isSameQuarter(generateConfig, date, now), }); // ========================= Header ========================= diff --git a/src/PickerPanel/YearPanel/index.tsx b/src/PickerPanel/YearPanel/index.tsx index 30d45f175..7a773fee5 100644 --- a/src/PickerPanel/YearPanel/index.tsx +++ b/src/PickerPanel/YearPanel/index.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import type { DisabledDate, SharedPanelProps } from '../../interface'; -import { formatValue, isSameYear } from '../../utils/dateUtil'; +import { formatValue } from '../../utils/dateUtil'; import { PanelContext, useInfo } from '../context'; import PanelBody from '../PanelBody'; import PanelHeader from '../PanelHeader'; @@ -21,7 +21,7 @@ export default function YearPanel( const panelPrefixCls = `${prefixCls}-year-panel`; // ========================== Base ========================== - const [info, now] = useInfo(props, 'year'); + const [info] = useInfo(props, 'year'); const startYear = Math.floor(generateConfig.getYear(pickerValue) / 10) * 10; const endYear = startYear + 9; @@ -47,7 +47,6 @@ export default function YearPanel( const dateYear = generateConfig.getYear(date); return { [`${prefixCls}-cell-in-view`]: startYear <= dateYear && dateYear <= endYear, - [`${prefixCls}-cell-today`]: isSameYear(generateConfig, date, now), }; }; diff --git a/tests/__snapshots__/panel.spec.tsx.snap b/tests/__snapshots__/panel.spec.tsx.snap index a27cf77a7..64e2fff9e 100644 --- a/tests/__snapshots__/panel.spec.tsx.snap +++ b/tests/__snapshots__/panel.spec.tsx.snap @@ -876,7 +876,7 @@ exports[`Picker.Panel append cell with cellRender in decade 1`] = `
1990-09 @@ -5060,7 +5060,7 @@ exports[`Picker.Panel override cell with cellRender in decade 1`] = `