fix(monitor): correct timezone conversion in monitor charts
Changes: - Correct time label parsing in hourly model request distribution chart - Correct time label parsing in hourly token usage chart - Mark ISO time strings as UTC to enable proper browser conversion to user's local time Modified files: - src/components/monitor/HourlyModelChart.tsx (modified) - src/components/monitor/HourlyTokenChart.tsx (modified) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -127,7 +127,7 @@ export function HourlyModelChart({ data, loading, isDark }: HourlyModelChartProp
|
||||
// 图表数据
|
||||
const chartData = useMemo(() => {
|
||||
const labels = hourlyData.hours.map((hour) => {
|
||||
const date = new Date(hour + ':00:00');
|
||||
const date = new Date(hour + ':00:00Z'); // 添加 Z 表示 UTC 时间,确保正确转换为本地时间显示
|
||||
return `${date.getHours()}:00`;
|
||||
});
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ export function HourlyTokenChart({ data, loading, isDark }: HourlyTokenChartProp
|
||||
// 图表数据
|
||||
const chartData = useMemo(() => {
|
||||
const labels = hourlyData.hours.map((hour) => {
|
||||
const date = new Date(hour + ':00:00');
|
||||
const date = new Date(hour + ':00:00Z'); // 添加 Z 表示 UTC 时间,确保正确转换为本地时间显示
|
||||
return `${date.getHours()}:00`;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user