homebox/frontend/components/global/DateTime.vue
2022-12-30 22:06:45 -09:00

22 lines
422 B
Vue

<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",
},
});
const value = computed(() => {
return fmtDate(props.date, props.format);
});
</script>