fix: preserve OHLCV stale detection
This commit is contained in:
@@ -77,7 +77,8 @@ function marketDate(date = new Date()): string {
|
||||
}
|
||||
|
||||
function formatSessionDate(isoDate: string): string {
|
||||
if (isoDate === marketDate()) return 'Today';
|
||||
const currentMarketDate = marketDate();
|
||||
if (isoDate === currentMarketDate) return 'Today';
|
||||
|
||||
// Parse date-only market sessions explicitly. Parsing YYYY-MM-DD directly as
|
||||
// a Date means midnight UTC and makes today's bar look many hours old.
|
||||
@@ -86,7 +87,7 @@ function formatSessionDate(isoDate: string): string {
|
||||
return new Intl.DateTimeFormat(undefined, {
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
year: year === new Date().getFullYear() ? undefined : 'numeric',
|
||||
year: year === Number(currentMarketDate.slice(0, 4)) ? undefined : 'numeric',
|
||||
timeZone: 'UTC',
|
||||
}).format(new Date(Date.UTC(year, month - 1, day)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user