-
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathdate.ts
More file actions
23 lines (19 loc) · 751 Bytes
/
date.ts
File metadata and controls
23 lines (19 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { adapter, dateConfiguration, enabled, i18n } from 'virtual:vuetify-date-configuration'
import type { VuetifyOptions } from 'vuetify'
import { useNuxtApp } from '#imports'
export function configureDate(vuetifyOptions: VuetifyOptions) {
// if (adapter === 'custom' || !enabled)
// return
const dateOptions = dateConfiguration()
if (i18n) {
// @ts-expect-error i18n is missing since it is not a dependency here
const locales: import('#i18n').LocaleObject[] | undefined = useNuxtApp().$i18n.locales.value
if (locales) {
dateOptions.locale = locales.reduce((acc, locale) => {
acc[locale.code] = locale.code
return acc
}, <Record<string, any>>{})
}
}
vuetifyOptions.date = dateOptions
}