@@ -667,5 +668,4 @@ $: {
-{/if}
-
\ No newline at end of file
+
diff --git a/src/routes/price-alert/+page.svelte b/src/routes/price-alert/+page.svelte
index c93b4f76..2c189eb2 100644
--- a/src/routes/price-alert/+page.svelte
+++ b/src/routes/price-alert/+page.svelte
@@ -3,29 +3,39 @@ import { numberOfUnreadNotification } from '$lib/store';
//import { enhance } from '$app/forms';
import toast from 'svelte-french-toast';
import { goto } from '$app/navigation';
-import { userRegion, screenWidth } from '$lib/store';
+import {screenWidth } from '$lib/store';
import MiniPlot from '$lib/components/MiniPlot.svelte';
import { onMount } from 'svelte';
let cloudFrontUrl = import.meta.env.VITE_IMAGE_URL;
-const usRegion = ['cle1','iad1','pdx1','sfo1'];
-
-let fastifyURL;
-
-userRegion.subscribe(value => {
- if (usRegion.includes(value)) {
- fastifyURL = import.meta.env.VITE_USEAST_FASTIFY_URL;
- } else {
- fastifyURL = import.meta.env.VITE_EU_FASTIFY_URL;
- }
-});
-
export let data;
const rawData = data?.getMiniPlotsIndex;
+function getCurrentDateFormatted() {
+ // Get current date
+ let date = new Date();
+
+ // If today is Saturday or Sunday, move to the previous Friday
+ if (date.getDay() === 6) { // Saturday
+ date.setDate(date.getDate() - 1);
+ } else if (date.getDay() === 0) { // Sunday
+ date.setDate(date.getDate() - 2);
+ }
+
+ // Define months array for formatting
+ const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
+
+ // Get formatted date components
+ const month = months[date.getMonth()];
+ const day = date.getDate();
+ const year = date.getFullYear();
+
+ // Return formatted date
+ return `${month} ${day}, ${year}`;
+}
let editMode = false;
let numberOfChecked = 0;
@@ -79,7 +89,7 @@ let priceAlertList = [];
async function getPriceAlert()
{
const postData = {'userId': data?.user?.id}
- const response = await fetch(fastifyURL+'/get-price-alert', {
+ const response = await fetch(data?.fastifyURL+'/get-price-alert', {
method: 'POST',
headers: {
"Content-Type": "application/json"
@@ -167,19 +177,7 @@ isLoaded = true;
-let charNumber =40;
-
-
-$: {
- if ($screenWidth < 640)
- {
- charNumber = 15;
- }
- else {
- charNumber =40;
- }
-}
-
+$: charNumber = $screenWidth < 640 ? 15 : 40;
@@ -259,8 +257,12 @@ $: {
{#if isLoaded}
-
-
+
+ Stock Indexes - {getCurrentDateFormatted()}
+
+
+
+
diff --git a/src/routes/watchlist/+page.svelte b/src/routes/watchlist/+page.svelte
index 5cd0bde9..0a73d1ab 100644
--- a/src/routes/watchlist/+page.svelte
+++ b/src/routes/watchlist/+page.svelte
@@ -18,6 +18,30 @@ export let data;
const rawData = data?.getMiniPlotsIndex;
+function getCurrentDateFormatted() {
+ // Get current date
+ let date = new Date();
+
+ // If today is Saturday or Sunday, move to the previous Friday
+ if (date.getDay() === 6) { // Saturday
+ date.setDate(date.getDate() - 1);
+ } else if (date.getDay() === 0) { // Sunday
+ date.setDate(date.getDate() - 2);
+ }
+
+ // Define months array for formatting
+ const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
+
+ // Get formatted date components
+ const month = months[date.getMonth()];
+ const day = date.getDate();
+ const year = date.getFullYear();
+
+ // Return formatted date
+ return `${month} ${day}, ${year}`;
+}
+
+
let priceDataSP500;
let priceDataNasdaq;
let priceDataDowJones;
@@ -412,8 +436,12 @@ onDestroy( () => {
{#if isLoaded}
-
-
+
+ Stock Indexes - {getCurrentDateFormatted()}
+
+
+