From a8e5f9bc72d30966bfc0c24c2db8ba330ca1327a Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Wed, 13 Sep 2023 11:26:18 +0530 Subject: [PATCH] Fixed: listing data not visible when listingTime information is missing(#225) --- src/views/catalog-product-details.vue | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/views/catalog-product-details.vue b/src/views/catalog-product-details.vue index 0efd2602..2b157eda 100644 --- a/src/views/catalog-product-details.vue +++ b/src/views/catalog-product-details.vue @@ -1059,24 +1059,27 @@ export default defineComponent({ status: metafieldValue.status, promiseDate: metafieldValue["promise_date"] } - const listingTime = DateTime.fromFormat(listData.listingTime, "MMM dd,yyyy HH:mm:ss").toLocaleString(DateTime.DATETIME_MED); + let listingTime = '' + if(listData.listingTime) { + listingTime = DateTime.fromFormat(listData.listingTime, "MMM dd,yyyy HH:mm:ss").toLocaleString(DateTime.DATETIME_MED); + } if (!listData.containsError) { if (listData.status === 'inactive') { - // showing the job's runTime as listing time - listData.listingTimeAndStatus = this.$t("Delisted at", { listingTime }) + // showing the job's runTime as listing time, and not showing listing time if not present + listingTime && (listData.listingTimeAndStatus = this.$t("Delisted at", { listingTime })) listData.listingStatus = 'Not listed' } else { - listData.listingTimeAndStatus = this.$t("Listed at", { listingTime }) + listingTime && (listData.listingTimeAndStatus = this.$t("Listed at", { listingTime })) listData.listingStatus = 'Listed' } } else { // If it failed to update, considered the status must old if (listData.status === 'inactive') { // showing the job's runTime as listing time - listData.listingTimeAndStatus = this.$t("Delisting failed at", { listingTime }) + listingTime && (listData.listingTimeAndStatus = this.$t("Delisting failed at", { listingTime })) listData.listingStatus = 'Listed' } else { - listData.listingTimeAndStatus = this.$t("Listing failed at", { listingTime }) + listingTime && (listData.listingTimeAndStatus = this.$t("Listing failed at", { listingTime })) listData.listingStatus = 'Not listed' } }