fix date and display errors

This commit is contained in:
Hayden 2022-10-08 11:02:34 -05:00
parent fdaf0f5790
commit 132e5d10da
3 changed files with 11 additions and 13 deletions

View file

@ -52,7 +52,7 @@
const loading = ref(false); const loading = ref(false);
const focused = ref(false); const focused = ref(false);
const form = reactive({ const form = reactive({
location: locations.value.length > 0 ? locations.value[0] : ({} as LocationOut), location: locations.value && locations.value.length > 0 ? locations.value[0] : ({} as LocationOut),
name: "", name: "",
description: "", description: "",
color: "", // Future! color: "", // Future!

View file

@ -19,7 +19,7 @@
return ""; return "";
} }
if (nullDate(dt)) { if (!validDate(dt)) {
return ""; return "";
} }
@ -35,10 +35,6 @@
} }
}); });
function nullDate(dt: Date) {
return dt.getFullYear() === 1;
}
const props = defineProps({ const props = defineProps({
date: { date: {
type: [Date, String], type: [Date, String],

View file

@ -177,14 +177,14 @@
if (preferences.value.showEmpty) { if (preferences.value.showEmpty) {
return true; return true;
} }
return item.value?.purchaseFrom || item.value?.purchasePrice; return item.value?.purchaseFrom || item.value?.purchasePrice !== "0";
}); });
const purchaseDetails = computed<(Detail | DateDetail)[]>(() => { const purchaseDetails = computed<Array<Detail | DateDetail>>(() => {
return [ return [
{ {
name: "Purchase From", name: "Purchase From",
label: item.value?.purchaseFrom || "", text: item.value?.purchaseFrom || "",
}, },
{ {
name: "Purchase Price", name: "Purchase Price",
@ -193,18 +193,19 @@
{ {
name: "Purchase Date", name: "Purchase Date",
text: item.value.purchaseTime, text: item.value.purchaseTime,
type: "date",
}, },
] as (Detail | DateDetail)[]; ];
}); });
const showSold = computed(() => { const showSold = computed(() => {
if (preferences.value.showEmpty) { if (preferences.value.showEmpty) {
return true; return true;
} }
return item.value?.soldTo || item.value?.soldPrice; return item.value?.soldTo || item.value?.soldPrice !== "0";
}); });
const soldDetails = computed<Array<Detail>>(() => { const soldDetails = computed<Array<Detail | DateDetail>>(() => {
return [ return [
{ {
name: "Sold To", name: "Sold To",
@ -217,8 +218,9 @@
{ {
name: "Sold At", name: "Sold At",
text: item.value?.soldTime || "", text: item.value?.soldTime || "",
type: "date",
}, },
] as Detail[]; ];
}); });
const confirm = useConfirm(); const confirm = useConfirm();