forked from mirrors/homebox
891d41b75f
* card option 1 * UI updates for item card * fix test error * fix pagination issues on backend * add integer support * remove date from cards * implement pagination for search page * resolve search state problems * other fixes * fix broken datetime * attempt to fix scroll behavior
25 lines
480 B
Vue
25 lines
480 B
Vue
<template>
|
|
{{ value }}
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
type DateTimeFormat = "relative" | "long" | "short" | "human";
|
|
|
|
type Props = {
|
|
date?: Date | string;
|
|
format?: DateTimeFormat;
|
|
};
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
date: undefined,
|
|
format: "relative",
|
|
});
|
|
|
|
const value = computed(() => {
|
|
if (!props.date || !validDate(props.date)) {
|
|
return "";
|
|
}
|
|
|
|
return fmtDate(props.date, props.format);
|
|
});
|
|
</script>
|