mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-03 12:37:42 +08:00
docs(DatePicker): update docs (#6450)
This commit is contained in:
parent
1977074a7e
commit
bf5fcdc269
@ -206,3 +206,20 @@ Please refer [replace date](/docs/vue/replace-date)
|
|||||||
### Why config dayjs.locale globally not work?
|
### 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.
|
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,
|
||||||
|
});
|
||||||
|
```
|
||||||
|
@ -207,3 +207,18 @@ export type FormatType = Generic | GenericFn | Array<Generic | GenericFn>;
|
|||||||
### 为何全局修改 dayjs.locale 不生效?
|
### 为何全局修改 dayjs.locale 不生效?
|
||||||
|
|
||||||
DatePicker 默认 `locale` 为 `en`。你可以通过 DatePicker 的 `locale` 属性来单独设置,也可以通过 [ConfigProvider `locale`](/components/config-provider-cn) 属性来配置。
|
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…
Reference in New Issue
Block a user