Skip to content

Commit

Permalink
feat: add year start & end (ant-design#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
xrkffgg authored Nov 20, 2020
1 parent 54dbe1d commit 524df82
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/panels/PanelBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import classNames from 'classnames';
import PanelContext from '../PanelContext';
import { GenerateConfig } from '../generate';
import { getLastDay } from '../utils/timeUtil';
import { PanelMode } from '../interface';

export interface PanelBodyProps<DateType> {
prefixCls: string;
disabledDate?: (date: DateType) => boolean;
onSelect: (value: DateType) => void;
picker?: PanelMode;

// By panel
headerCells?: React.ReactNode;
Expand All @@ -30,6 +32,7 @@ export default function PanelBody<DateType>({
prefixCls,
disabledDate,
onSelect,
picker,
rowNum,
colNum,
prefixColumn,
Expand Down Expand Up @@ -75,8 +78,8 @@ export default function PanelBody<DateType>({
title={title}
className={classNames(cellPrefixCls, {
[`${cellPrefixCls}-disabled`]: disabled,
[`${cellPrefixCls}-start`]: getCellText(currentDate) === 1,
[`${cellPrefixCls}-end`]: title === getLastDay(generateConfig, currentDate),
[`${cellPrefixCls}-start`]: getCellText(currentDate) === 1 || picker === 'year' && Number(title) % 10 === 0,
[`${cellPrefixCls}-end`]: title === getLastDay(generateConfig, currentDate) || picker === 'year' && Number(title) % 10 === 9,
...getCellClassName(currentDate),
})}
onClick={() => {
Expand Down

0 comments on commit 524df82

Please sign in to comment.