fix datetime display issues (again) (#324)

This commit is contained in:
Hayden 2023-02-27 19:52:56 -09:00 committed by GitHub
parent 025521431e
commit cf536393f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 46 additions and 14 deletions

View file

@ -3,16 +3,18 @@
</template>
<script setup lang="ts">
type DateTimeFormat = "relative" | "long" | "short" | "human";
import { 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(() => {
@ -20,6 +22,6 @@
return "";
}
return fmtDate(props.date, props.format);
return fmtDate(props.date, props.format, props.datetimeType);
});
</script>