mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-25 10:46:17 +03:00
9 lines
344 B
TypeScript
9 lines
344 B
TypeScript
import type { MaybeRef } from '@vueuse/core'
|
|
|
|
export const useFormattedDateTime = (
|
|
value: MaybeRef<string | Date>,
|
|
options: Intl.DateTimeFormatOptions = { dateStyle: 'long', timeStyle: 'medium' },
|
|
) => {
|
|
const formatter = Intl.DateTimeFormat(undefined, options)
|
|
return computed(() => formatter.format(new Date(resolveUnref(value))))
|
|
}
|