|
|
|
@ -2,7 +2,7 @@ import dayjs from 'dayjs';
|
|
|
|
import relativeTime from 'dayjs/plugin/relativeTime'; // 导入插件
|
|
|
|
import relativeTime from 'dayjs/plugin/relativeTime'; // 导入插件
|
|
|
|
import duration from 'dayjs/plugin/duration'; // 导入插件
|
|
|
|
import duration from 'dayjs/plugin/duration'; // 导入插件
|
|
|
|
import 'dayjs/locale/zh-cn'; // 导入本地化语言
|
|
|
|
import 'dayjs/locale/zh-cn'; // 导入本地化语言
|
|
|
|
import { onLanguageChange } from '../i18n';
|
|
|
|
import { onLanguageChanged } from '../i18n';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Reference: https://day.js.org/
|
|
|
|
* Reference: https://day.js.org/
|
|
|
|
@ -11,7 +11,7 @@ import { onLanguageChange } from '../i18n';
|
|
|
|
dayjs.extend(relativeTime);
|
|
|
|
dayjs.extend(relativeTime);
|
|
|
|
dayjs.extend(duration);
|
|
|
|
dayjs.extend(duration);
|
|
|
|
dayjs.locale('zh-cn'); // 默认使用中文
|
|
|
|
dayjs.locale('zh-cn'); // 默认使用中文
|
|
|
|
onLanguageChange((lang) => {
|
|
|
|
onLanguageChanged((lang) => {
|
|
|
|
if (lang === 'en-US') {
|
|
|
|
if (lang === 'en-US') {
|
|
|
|
dayjs.locale('en');
|
|
|
|
dayjs.locale('en');
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|