mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-27 02:55:42 +00:00
b77c9be36f
* bump prettier/eslint-plugin * bump nuxt pwa * use typed imports * set vue version to fix layout errors * disable import
27 lines
559 B
Vue
27 lines
559 B
Vue
<template>
|
|
{{ value }}
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { DateTimeFormat, DateTimeType } from "~~/composables/use-formatters";
|
|
|
|
type Props = {
|
|
date?: Date | string;
|
|
format?: DateTimeFormat;
|
|
datetimeType?: DateTimeType;
|
|
};
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
date: undefined,
|
|
format: "relative",
|
|
datetimeType: "date",
|
|
});
|
|
|
|
const value = computed(() => {
|
|
if (!props.date || !validDate(props.date)) {
|
|
return "";
|
|
}
|
|
|
|
return fmtDate(props.date, props.format);
|
|
});
|
|
</script>
|