From e9a090d674c72e2dc60ff197da1e699f6c56b949 Mon Sep 17 00:00:00 2001 From: "bai.zixv" Date: Fri, 19 Apr 2024 14:17:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A7=86=E5=9B=BE,=20?= =?UTF-8?q?=E5=BD=93=E6=97=A5=E6=9C=9F=E6=B2=A1=E6=9C=89=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=97=B6,=E5=89=8D=E7=AB=AF=E6=98=BE=E7=A4=BAInvalid=20Date=20?= =?UTF-8?q?(#767)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ![image](/attachments/be7d49d9-2d06-4f06-8087-46be51add4cb) ![image](/attachments/f969e654-7d3f-4eef-8bea-21f8dcf3a909) Co-authored-by: sealday Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachybase/pulls/767 Co-authored-by: bai.zixv Co-committed-by: bai.zixv --- .../src/nocobase-buildin-plugin/plugins/LocalePlugin.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/core/client/src/nocobase-buildin-plugin/plugins/LocalePlugin.ts b/packages/core/client/src/nocobase-buildin-plugin/plugins/LocalePlugin.ts index 2c276a4ba..d356a86d3 100644 --- a/packages/core/client/src/nocobase-buildin-plugin/plugins/LocalePlugin.ts +++ b/packages/core/client/src/nocobase-buildin-plugin/plugins/LocalePlugin.ts @@ -36,6 +36,13 @@ export class LocalePlugin extends Plugin { const dayjsLang = dayjsLocale[data?.data?.lang] || 'en'; await import(`dayjs/locale/${dayjsLang}`); dayjs.locale(dayjsLang); + + // 防止数据源没有日期值的时候, 界面显示 Invalid Date + const updateLocale = await import('dayjs/plugin/updateLocale'); + dayjs.extend(updateLocale.default); + const localeSetting = { invalidDate: '-' }; + dayjs.updateLocale(dayjsLang, localeSetting); + window['cronLocale'] = data?.data?.cron; } catch (error) { (() => {})();