bugfixing

This commit is contained in:
MuslemRahimi 2025-02-26 00:15:51 +01:00
parent 05b9d7095f
commit 999e97367f
4 changed files with 23 additions and 15 deletions

8
package-lock.json generated
View File

@ -35,7 +35,7 @@
"compression": "^1.7.4", "compression": "^1.7.4",
"d3-hierarchy": "^3.1.2", "d3-hierarchy": "^3.1.2",
"d3-sankey": "^0.12.3", "d3-sankey": "^0.12.3",
"daisyui": "^4.12.23", "daisyui": "^4.12.24",
"date-fns": "^3.6.0", "date-fns": "^3.6.0",
"date-fns-tz": "^3.1.3", "date-fns-tz": "^3.1.3",
"date-picker-svelte": "^2.12.0", "date-picker-svelte": "^2.12.0",
@ -4093,9 +4093,9 @@
"license": "BSD-3-Clause" "license": "BSD-3-Clause"
}, },
"node_modules/daisyui": { "node_modules/daisyui": {
"version": "4.12.23", "version": "4.12.24",
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.12.23.tgz", "resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.12.24.tgz",
"integrity": "sha512-EM38duvxutJ5PD65lO/AFMpcw+9qEy6XAZrTpzp7WyaPeO/l+F/Qiq0ECHHmFNcFXh5aVoALY4MGrrxtCiaQCQ==", "integrity": "sha512-JYg9fhQHOfXyLadrBrEqCDM6D5dWCSSiM6eTNCRrBRzx/VlOCrLS8eDfIw9RVvs64v2mJdLooKXY8EwQzoszAA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {

View File

@ -34,7 +34,7 @@
"compression": "^1.7.4", "compression": "^1.7.4",
"d3-hierarchy": "^3.1.2", "d3-hierarchy": "^3.1.2",
"d3-sankey": "^0.12.3", "d3-sankey": "^0.12.3",
"daisyui": "^4.12.23", "daisyui": "^4.12.24",
"date-fns": "^3.6.0", "date-fns": "^3.6.0",
"date-fns-tz": "^3.1.3", "date-fns-tz": "^3.1.3",
"date-picker-svelte": "^2.12.0", "date-picker-svelte": "^2.12.0",

View File

@ -163,14 +163,16 @@ export const groupEarnings = (earnings) => {
return Object?.entries( return Object?.entries(
earnings earnings
?.reduce((acc, item) => { ?.reduce((acc, item) => {
const dateKey = new Intl.DateTimeFormat('en-US', { const date = new Date(item?.date);
const berlinDate = new Intl.DateTimeFormat('en-US', {
day: '2-digit', day: '2-digit',
month: 'short', month: 'short',
year: 'numeric', year: 'numeric',
}).format(new Date(item?.date)); timeZone: 'Europe/Berlin'
}).format(date);
if (!acc[dateKey]) acc[dateKey] = []; if (!acc[berlinDate]) acc[berlinDate] = [];
acc[dateKey]?.push(item); acc[berlinDate]?.push(item);
return acc; return acc;
}, {}) }, {})
) )
@ -180,14 +182,19 @@ export const groupEarnings = (earnings) => {
date, date,
// Sort earnings within the date by time // Sort earnings within the date by time
earnings?.sort((a, b) => { earnings?.sort((a, b) => {
const timeA = new Date(`1970-01-01T${a?.time}`); const berlinTimeA = new Date(
const timeB = new Date(`1970-01-01T${b?.time}`); new Date(`${item.date}T${a?.time}`).toLocaleString('en-US', { timeZone: 'Europe/Berlin' })
return timeB - timeA; );
const berlinTimeB = new Date(
new Date(`${item.date}T${b?.time}`).toLocaleString('en-US', { timeZone: 'Europe/Berlin' })
);
return berlinTimeB - berlinTimeA;
}) })
]); ]);
}; };
export const groupNews = (news, watchList) => { export const groupNews = (news, watchList) => {
return Object.entries( return Object.entries(
news news

View File

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { screenWidth, numberOfUnreadNotification, isOpen } from "$lib/store"; import { screenWidth, isOpen } from "$lib/store";
import { import {
groupNews, groupNews,
groupEarnings, groupEarnings,
@ -7,6 +7,7 @@
formatTime, formatTime,
abbreviateNumber, abbreviateNumber,
calculateChange, calculateChange,
removeCompanyStrings,
} from "$lib/utils"; } from "$lib/utils";
import toast from "svelte-french-toast"; import toast from "svelte-french-toast";
import { onMount, onDestroy, afterUpdate } from "svelte"; import { onMount, onDestroy, afterUpdate } from "svelte";
@ -500,7 +501,7 @@
groupedEarnings = groupEarnings(earnings); groupedEarnings = groupEarnings(earnings);
} else { } else {
groupedEarnings = []; groupedEarnings = [];
groupedEarnings = []; groupedNews = [];
} }
} }
} }
@ -1818,7 +1819,7 @@
class="flex-grow px-3 py-2 lg:py-1 border-t border-gray-700" class="flex-grow px-3 py-2 lg:py-1 border-t border-gray-700"
> >
<div> <div>
<strong>{item?.name}</strong> {removeCompanyStrings(item?.name)}
(<HoverStockChart symbol={item?.symbol} />) (<HoverStockChart symbol={item?.symbol} />)
will report will report