From 7179a6aaeeb84042631595656b77484190b975cb Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Mon, 6 Jan 2025 22:16:39 +0100 Subject: [PATCH] ui fixes --- .../etf/[tickerID]/options/hottest-contracts/+page.svelte | 7 +++---- .../[tickerID]/options/hottest-contracts/+page.svelte | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/routes/etf/[tickerID]/options/hottest-contracts/+page.svelte b/src/routes/etf/[tickerID]/options/hottest-contracts/+page.svelte index fb71a9f6..c75885cf 100644 --- a/src/routes/etf/[tickerID]/options/hottest-contracts/+page.svelte +++ b/src/routes/etf/[tickerID]/options/hottest-contracts/+page.svelte @@ -132,8 +132,8 @@ // Convert the expiration date to a Date object const expirationDate = new Date(dateExpiration); - return data.map((item) => { - const itemDate = new Date(item.date); // Convert item.date to a Date object + return data?.map((item) => { + const itemDate = new Date(item?.date); // Convert item.date to a Date object const timeDifference = expirationDate - itemDate; // Difference in milliseconds const dte = Math.ceil(timeDifference / (1000 * 60 * 60 * 24)); // Convert ms to days @@ -304,7 +304,6 @@ let data = rawDataHistory?.sort( (a, b) => new Date(a?.date) - new Date(b?.date), ); - console.log(data); let dates = data?.map((item) => item?.date); let avgPrice = data?.map((item) => item?.avg_price); let priceList = data?.map((item) => item?.price); @@ -430,7 +429,7 @@ // Add DTE at the end if the data point exists if (rawDataPoint?.dte !== undefined) { - result += `DTE: ${rawDataPoint.dte}
`; + result += `Days to Expiration : ${rawDataPoint.dte}
`; } return result; diff --git a/src/routes/stocks/[tickerID]/options/hottest-contracts/+page.svelte b/src/routes/stocks/[tickerID]/options/hottest-contracts/+page.svelte index af48c937..a484a1fd 100644 --- a/src/routes/stocks/[tickerID]/options/hottest-contracts/+page.svelte +++ b/src/routes/stocks/[tickerID]/options/hottest-contracts/+page.svelte @@ -304,7 +304,6 @@ let data = rawDataHistory?.sort( (a, b) => new Date(a?.date) - new Date(b?.date), ); - console.log(data); let dates = data?.map((item) => item?.date); let avgPrice = data?.map((item) => item?.avg_price); let priceList = data?.map((item) => item?.price); @@ -428,9 +427,8 @@ result += `${bidColor}Bid x ${askColor}Ask: ${bidValue} x ${askValue}
`; } - // Add DTE at the end if the data point exists if (rawDataPoint?.dte !== undefined) { - result += `DTE: ${rawDataPoint.dte}
`; + result += `Days to Expiration : ${rawDataPoint.dte}
`; } return result;