refactor: prevent error

This commit is contained in:
Methapon2001 2024-12-17 14:57:50 +07:00
parent ca38cfaec0
commit ed423cfaf7

View file

@ -1,7 +1,6 @@
import moment from 'moment';
import 'moment/dist/locale/th';
import 'moment/dist/locale/en-gb';
import { useI18n } from 'vue-i18n';
import { i18n } from 'src/boot/i18n';
import { Lang } from './ui';
@ -133,7 +132,7 @@ export function calculateAge(
return only === 'year' ? years : only === 'months' ? months : days;
}
const { locale } = useI18n();
const { locale } = i18n.global;
if (locale.value === 'tha') {
return `${years} ปี ${months !== 0 ? months + ' เดือน' : ''} ${days !== 0 ? days + ' วัน' : ''} `;
} else {