From 0abb00e416de1bfce9fdc9d7fe87f9cd52ace3e7 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Mon, 3 Feb 2025 13:51:59 +0100 Subject: [PATCH] ui fixes --- src/routes/potus-tracker/+page.svelte | 77 +++++++++++++++++++-------- src/routes/profile/+page.svelte | 1 - 2 files changed, 54 insertions(+), 24 deletions(-) diff --git a/src/routes/potus-tracker/+page.svelte b/src/routes/potus-tracker/+page.svelte index 847d5e15..84552267 100644 --- a/src/routes/potus-tracker/+page.svelte +++ b/src/routes/potus-tracker/+page.svelte @@ -55,10 +55,6 @@ return acc; }, {}); - let modalTitle = "n/a"; - let modalDescription = "n/a"; - let modalLink = "#"; - const tabs = [ { title: "Location Tracker", @@ -201,6 +197,31 @@ } let options = plotData(); + + function latestInfoDate(inputDate) { + // Create a Date object for the input date and convert it to New York time zone + const inputDateLocal = new Date(inputDate).toLocaleString("en-US", { + timeZone: "America/New_York", + }); + + // Get the current date and time in New York timezone + const todayLocal = new Date().toLocaleString("en-US", { + timeZone: "America/New_York", + }); + + // Convert the localized strings back to Date objects + const inputDateMs = new Date(inputDateLocal).getTime(); + const todayMs = new Date(todayLocal).getTime(); + + // Calculate the difference in milliseconds + const differenceInMs = todayMs - inputDateMs; + + // Convert milliseconds to days + const differenceInDays = Math.floor(differenceInMs / (1000 * 60 * 60 * 24)); + + // Return whether the difference is less than or equal to 1 day + return differenceInDays <= 2; + } - + {item.time_formatted} - {item.location} - + {item.details} @@ -416,17 +437,23 @@ {:else}

- Latest Executive Orders analyzed by AI + AI-Powered Analysis of the Latest Executive Orders

{#each Object.entries(groupedOrders) as [date, items], indexA}
{date} + {#if latestInfoDate(date)} + + {/if}

@@ -472,35 +499,39 @@ {/if}
- +
- {item?.sentiment} - - - - {item.title} - +
- {item.description} + {item?.sentiment} + + + {item.description} Source