From d9d44195a6f99301a826b3fd8b6aa8c722ae42ea Mon Sep 17 00:00:00 2001 From: LHH <63722633+dayzKo1@users.noreply.github.com> Date: Fri, 30 Jun 2023 17:49:00 +0800 Subject: [PATCH] docs: fix dayjs updateLocale usage (#43250) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix:dayjs中没有updateLocale方法,直接使用local("zh-cn") codesandbox中的示例也报错了。。找不到updateLocale方法 * Apply suggestions from code review Signed-off-by: afc163 * Update index.en-US.md --------- Signed-off-by: afc163 Co-authored-by: afc163 --- components/date-picker/index.en-US.md | 3 ++- components/date-picker/index.zh-CN.md | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/date-picker/index.en-US.md b/components/date-picker/index.en-US.md index 7a83397476..e8360aaff0 100644 --- a/components/date-picker/index.en-US.md +++ b/components/date-picker/index.en-US.md @@ -248,8 +248,9 @@ Please use correct [language](/docs/react/i18n) ([#5605](https://github.com/ant- ```js import dayjs from 'dayjs'; import 'dayjs/locale/zh-cn'; -import 'dayjs/plugin/updateLocale'; +import updateLocale from 'dayjs/plugin/updateLocale'; +dayjs.extend(updateLocale); dayjs.updateLocale('zh-cn', { weekStart: 0, }); diff --git a/components/date-picker/index.zh-CN.md b/components/date-picker/index.zh-CN.md index ebd1c63fdd..0d5eda09a1 100644 --- a/components/date-picker/index.zh-CN.md +++ b/components/date-picker/index.zh-CN.md @@ -243,8 +243,10 @@ export type FormatType = Generic | GenericFn | Array; ```js import dayjs from 'dayjs'; import 'dayjs/locale/zh-cn'; -import 'dayjs/plugin/updateLocale'; +import updateLocale from 'dayjs/plugin/updateLocale'; + +dayjs.extend(updateLocale); dayjs.updateLocale('zh-cn', { weekStart: 0, });