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 focused = ref(false);
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: "",
description: "",
color: "", // Future!

View file

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

View file

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