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:
kongkongyo
2026-01-14 16:07:39 +08:00
parent 9805219fe8
commit 76bfa26d3e
2 changed files with 2 additions and 2 deletions

View File

@@ -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`;
});

View File

@@ -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`;
});