2016-05-22 11:03:07 +08:00
---
category: Components
2016-11-09 14:43:32 +08:00
type: Data Display
2016-05-22 11:03:07 +08:00
cols: 1
title: Calendar
2020-05-31 11:48:34 +08:00
cover: https://gw.alipayobjects.com/zos/antfincdn/dPQmLq08DI/Calendar.svg
2016-05-22 11:03:07 +08:00
---
2016-11-29 17:13:24 +08:00
Container for displaying data in calendar form.
2016-05-22 11:03:07 +08:00
2016-09-10 13:43:30 +08:00
## When To Use
2016-05-22 11:03:07 +08:00
2017-09-16 11:29:05 +08:00
When data is in the form of dates, such as schedules, timetables, prices calendar, lunar calendar. This component also supports Year/Month switch.
2016-05-22 11:03:07 +08:00
## API
2017-09-16 11:29:05 +08:00
**Note:** Part of the Calendar's locale is read from `value` . So, please set the locale of `moment` correctly.
2017-02-23 15:57:05 +08:00
```jsx
2018-11-09 20:05:18 +08:00
// The default locale is en-US, if you want to use other locale, just set locale in entry file globally.
2017-09-26 23:12:47 +08:00
// import moment from 'moment';
// import 'moment/locale/zh-cn';
// moment.locale('zh-cn');
2017-02-23 15:57:05 +08:00
2016-05-22 11:03:07 +08:00
< Calendar
dateCellRender={dateCellRender}
monthCellRender={monthCellRender}
onPanelChange={onPanelChange}
2017-03-03 15:26:23 +08:00
onSelect={onSelect}
2016-05-22 11:03:07 +08:00
/>
```
2019-05-26 13:09:06 +08:00
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| dateCellRender | Customize the display of the date cell, the returned content will be appended to the cell | function(date: moment): ReactNode | - | |
| dateFullCellRender | Customize the display of the date cell, the returned content will override the cell | function(date: moment): ReactNode | - | |
2020-07-01 22:37:55 +08:00
| defaultValue | The date selected by default | [moment ](http://momentjs.com/ ) | - | |
2019-05-26 13:09:06 +08:00
| disabledDate | Function that specifies the dates that cannot be selected | (currentDate: moment) => boolean | - | |
2020-06-17 23:18:14 +08:00
| fullscreen | Whether to display in full-screen | boolean | true | |
2020-10-21 10:33:43 +08:00
| headerRender | Render custom header in panel | function(object:{value: moment, type: string, onChange: f(), onTypeChange: f()}) | - | |
2020-07-01 22:37:55 +08:00
| locale | The calendar's locale | object | [(default) ](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json ) | |
2019-05-26 13:09:06 +08:00
| mode | The display mode of the calendar | `month` \| `year` | `month` | |
| monthCellRender | Customize the display of the month cell, the returned content will be appended to the cell | function(date: moment): ReactNode | - | |
| monthFullCellRender | Customize the display of the month cell, the returned content will override the cell | function(date: moment): ReactNode | - | |
2020-07-01 22:37:55 +08:00
| validRange | To set valid range | \[[moment ](http://momentjs.com/ ), [moment ](http://momentjs.com/ )] | - | |
| value | The current selected date | [moment ](http://momentjs.com/ ) | - | |
2020-10-21 10:33:43 +08:00
| onChange | Callback for when date changes | function(date: moment) | - | |
2019-05-26 13:09:06 +08:00
| onPanelChange | Callback for when panel changes | function(date: moment, mode: string) | - | |
| onSelect | Callback for when a date is selected | function(date: moment) | - | |
2020-01-02 16:05:59 +08:00
## FAQ
2020-01-08 11:29:37 +08:00
- [How to use Calendar with customize date library like dayjs ](/docs/react/replace-moment#Calendar )