Browse Source

docs(DatePicker): update docs (#6450)

pull/6460/head
Cherry7 2 years ago committed by GitHub
parent
commit
bf5fcdc269
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      components/date-picker/index.en-US.md
  2. 15
      components/date-picker/index.zh-CN.md

17
components/date-picker/index.en-US.md

@ -206,3 +206,20 @@ Please refer [replace date](/docs/vue/replace-date)
### Why config dayjs.locale globally not work?
DatePicker default set `locale` as `en` in v4. You can config DatePicker `locale` prop or [ConfigProvider `locale`](/components/config-provider) prop instead.
### How to modify start day of week?
Please use correct [language](/docs/vue/i18n) ([#5605](https://github.com/ant-design/ant-design/issues/5605)), or update dayjs `locale` config:
- Example: <https://codesandbox.io/s/dayjs-day-of-week-x9tuj2?file=/demo.tsx>
```js
import dayjs from 'dayjs';
import updateLocale from 'dayjs/plugin/updateLocale';
import 'dayjs/locale/zh-cn';
dayjs.extend(updateLocale);
dayjs.updateLocale('zh-cn', {
weekStart: 0,
});
```

15
components/date-picker/index.zh-CN.md

@ -207,3 +207,18 @@ export type FormatType = Generic | GenericFn | Array<Generic | GenericFn>;
### 为何全局修改 dayjs.locale 不生效?
DatePicker 默认 `locale``en`。你可以通过 DatePicker 的 `locale` 属性来单独设置,也可以通过 [ConfigProvider `locale`](/components/config-provider-cn) 属性来配置。
### 如何修改周的起始日?
请使用正确的[语言包](/docs/vue/i18n-cn)([#5605](https://github.com/ant-design/ant-design/issues/5605)),或者修改 dayjs 的 `locale` 配置:<https://codesandbox.io/s/dayjs-day-of-week-x9tuj2?file=/demo.tsx>
```js
import dayjs from 'dayjs';
import updateLocale from 'dayjs/plugin/updateLocale';
import 'dayjs/locale/zh-cn';
dayjs.extend(updateLocale);
dayjs.updateLocale('zh-cn', {
weekStart: 0,
});
```

Loading…
Cancel
Save