fix: 修复视图, 当日期没有数据时,前端显示Invalid Date (#767)
![image](/attachments/be7d49d9-2d06-4f06-8087-46be51add4cb) ![image](/attachments/f969e654-7d3f-4eef-8bea-21f8dcf3a909) Co-authored-by: sealday <zhanglin@daoyoucloud.com> Reviewed-on: daoyoucloud/tachybase#767 Co-authored-by: bai.zixv <bai.zixv@foxmail.com> Co-committed-by: bai.zixv <bai.zixv@foxmail.com>
This commit is contained in:
parent
95fc2c4e16
commit
e9a090d674
@ -36,6 +36,13 @@ export class LocalePlugin extends Plugin {
|
|||||||
const dayjsLang = dayjsLocale[data?.data?.lang] || 'en';
|
const dayjsLang = dayjsLocale[data?.data?.lang] || 'en';
|
||||||
await import(`dayjs/locale/${dayjsLang}`);
|
await import(`dayjs/locale/${dayjsLang}`);
|
||||||
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;
|
window['cronLocale'] = data?.data?.cron;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
(() => {})();
|
(() => {})();
|
||||||
|
Loading…
Reference in New Issue
Block a user