From 5e6d2ae233a41507916bb60c8064e0d5714b42bf Mon Sep 17 00:00:00 2001 From: lamvh <27491634+lamvh@users.noreply.github.com> Date: Sat, 28 Sep 2024 10:31:47 +0700 Subject: [PATCH] feat(mobile): add Vietnamese support for dates (#383) Issue: https://github.com/get6pm/6pm/issues/283 --- apps/mobile/locales/provider.tsx | 3 +++ packages/utilities/src/date/dayjs.ts | 1 + 2 files changed, 4 insertions(+) diff --git a/apps/mobile/locales/provider.tsx b/apps/mobile/locales/provider.tsx index 5cee3fb9..66eff0ef 100644 --- a/apps/mobile/locales/provider.tsx +++ b/apps/mobile/locales/provider.tsx @@ -1,3 +1,4 @@ +import { dayjsExtended } from '@6pm/utilities' import { i18n } from '@lingui/core' import { I18nProvider } from '@lingui/react' import AsyncStorage from '@react-native-async-storage/async-storage' @@ -18,6 +19,8 @@ const defaultLanguage = ['en', 'vi'].includes(deviceLanguage) ? deviceLanguage : 'en' +dayjsExtended.locale(deviceLanguage) + const messages = { en: enMessages, vi: viMessages, diff --git a/packages/utilities/src/date/dayjs.ts b/packages/utilities/src/date/dayjs.ts index adda2572..e61ff797 100644 --- a/packages/utilities/src/date/dayjs.ts +++ b/packages/utilities/src/date/dayjs.ts @@ -1,6 +1,7 @@ import dayjsExtended from 'dayjs' import isoWeek from 'dayjs/plugin/isoWeek' import quarterOfYear from 'dayjs/plugin/quarterOfYear' +import 'dayjs/locale/vi' dayjsExtended.extend(isoWeek) dayjsExtended.extend(quarterOfYear)