fix: use toISOString for trend date serialization to prevent year 2001 bug
pg driver returns PostgreSQL date as JS Date object. String(date).slice(0,10) produced "Mon Apr 07" instead of "2026-04-07", causing chart tooltips to default to year 2001 when parsed by new Date().
This commit is contained in:
@@ -107,7 +107,7 @@ export async function getTrends(
|
||||
);
|
||||
|
||||
return rows.map((r) => ({
|
||||
date: String(r.date).slice(0, 10),
|
||||
date: r.date instanceof Date ? r.date.toISOString().slice(0, 10) : String(r.date).slice(0, 10),
|
||||
calls: Number(r.calls),
|
||||
prompt_tokens: Number(r.prompt_tokens),
|
||||
completion_tokens: Number(r.completion_tokens),
|
||||
|
||||
Reference in New Issue
Block a user