small fix

This commit is contained in:
MuslemRahimi 2025-01-07 20:13:42 +01:00
parent c6b93a1d73
commit 9bbba4b427

View File

@ -97,21 +97,23 @@
// Calculate percentage change if baseClose and currentDataRow are valid // Calculate percentage change if baseClose and currentDataRow are valid
const closeValue = const closeValue =
$realtimePrice !== null $realtimePrice !== null && $realtimePrice !== undefined
? $realtimePrice ? $realtimePrice
: (currentDataRowOneDay?.close ?? currentDataRowOneDay?.value); : (currentDataRowOneDay?.close ?? currentDataRowOneDay?.value);
const graphCloseValue = const graphCloseValue =
$realtimePrice !== null $realtimePrice !== null && $realtimePrice !== undefined
? $realtimePrice ? $realtimePrice
: (currentDataRow?.close ?? currentDataRow?.value); : (currentDataRow?.close ?? currentDataRow?.value);
if (closeValue && baseClose) { if (closeValue && baseClose) {
change = ((closeValue / baseClose - 1) * 100).toFixed(2); change = ((closeValue / baseClose - 1) * 100)?.toFixed(2);
} }
if (graphCloseValue && graphBaseClose) { if (graphCloseValue && graphBaseClose) {
graphChange = ((graphCloseValue / graphBaseClose - 1) * 100).toFixed(2); graphChange = ((graphCloseValue / graphBaseClose - 1) * 100)?.toFixed(
2,
);
} }
// Format date // Format date