homebox/frontend/components/global/DateTime.vue

23 lines
422 B
Vue
Raw Normal View History

<template>
{{ value }}
</template>
<script setup lang="ts">
type DateTimeFormat = "relative" | "long" | "short" | "human";
const props = defineProps({
date: {
type: [Date, String],
required: true,
},
format: {
type: String as () => DateTimeFormat,
default: "relative",
},
});
2022-12-31 07:06:45 +00:00
const value = computed(() => {
return fmtDate(props.date, props.format);
});
</script>