Files
directus/src/utils/localized-format/localized-format.ts
Rijk van Zanten b5d6fdefa2 Add date(time) interface (#499)
* Add localized-format util

* Add active prop to v-input

* Add strings for datetime interface

* Add overflow-scroll prop to v-menu

* Add close-on-content-click prop to v-select

* Add datetime interface

* Show display value synced with prop

* Sync value with prop

* Set lang after user hydration

* Add NL date-fns lang to test datetime

* Fix locale fetching in date-fns

* Dont stage value if year isnt fully filled out

* Localize date fns based on shared util

* Handle type, render type based display

* Don't use exact on v-list-item

* Pass type to interface on v-form
2020-04-29 10:00:22 -04:00

12 lines
390 B
TypeScript

import formatOriginal from 'date-fns/format';
import getDateFNSLocale from '@/utils/get-date-fns-locale';
type localizedFormat = (...a: Parameters<typeof formatOriginal>) => Promise<string>;
export const localizedFormat: localizedFormat = async (date, format, options): Promise<string> => {
return formatOriginal(date, format, {
...options,
locale: await getDateFNSLocale(),
});
};