## How to use DatePicker with customize date library like dayjs?
Consider of bundle size, you can replace momentjs with customize date library. We provide two ways to customize date library:
### Custom component
The first way is use `generatePicker` (or `generateCalendar`) helps to create Picker components.
First, we initialize an antd demo of `create-react-app`. You can refer to [Use in TypeScript](/docs/react/use-in-typescript), or you can start directly here [init antd](https://github.com/xiaohuoni/antd4-generate-picker/commit/47fec964e36d48bd15760f8f5abcb9655c259aa6)
#### DatePicker.tsx
Create `src/components/DatePicker.tsx`.
For example:
```tsx
import { Dayjs } from 'dayjs';
import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
import generatePicker from 'antd/es/date-picker/generatePicker';
export { default as DatePicker } from './DatePicker';
export { default as Calendar } from './Calendar';
export { default as TimePicker } from './TimePicker';
```
#### Use Custom component
Modify `src/App.tsx`,import `dayjs` and custom component.
```diff
- import { DatePicker, Calendar } from 'antd';
- import format from 'moment';
+ import { DatePicker, TimePicker, Calendar } from './components';
+ import format from 'dayjs';
```
If the above steps do not work correctly, you can refer [antd4-generate-picker/antd-ts](https://github.com/xiaohuoni/antd4-generate-picker/tree/master/antd-ts).
If you need JavaScript code, you can refer [antd4-generate-picker/antd-demo](https://github.com/xiaohuoni/antd4-generate-picker/tree/master/antd-demo).
If you are the user of [umi](https://umijs.org/), you can ref [antd4-use-dayjs-replace-moment](https://github.com/xiaohuoni/antd4-use-dayjs-replace-moment).
### Webpack plugin
We also provide another implementation. We provide `antd-dayjs-webpack-plugin` plugin to replace `momentjs` to `Day.js` directly without changing a line of existing code. More info at [antd-dayjs-webpack-plugin](https://github.com/ant-design/antd-dayjs-webpack-plugin).