refactor: editor page (#276)

This commit is contained in:
Hayden 2023-02-13 10:43:09 -09:00 committed by GitHub
parent 9361997a42
commit 986d2c586e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 82 additions and 34 deletions

View file

@ -18,7 +18,7 @@
const props = defineProps({
modelValue: {
type: Date,
type: Date as () => Date | string,
required: false,
default: null,
},
@ -32,6 +32,10 @@
get() {
// return modelValue as string as YYYY-MM-DD or null
if (validDate(props.modelValue)) {
if (typeof props.modelValue === "string") {
return props.modelValue;
}
return props.modelValue ? props.modelValue.toISOString().split("T")[0] : null;
}