Token 使用趋势 X 轴标签从星期改为具体日期(月/日 格式)

This commit is contained in:
wangxiaoji 2026-06-30 09:59:15 +08:00
parent 6a99f229e3
commit 847c2bd9d3
1 changed files with 7 additions and 3 deletions

View File

@ -22,7 +22,11 @@ import { TrendingUp } from 'lucide-react';
import Sparkline from './Sparkline'; import Sparkline from './Sparkline';
import { renderQuota } from '../../helpers'; import { renderQuota } from '../../helpers';
const WEEKDAYS_SHORT = ['日', '一', '二', '三', '四', '五', '六']; const formatMD = (d) => {
const m = d.getMonth() + 1;
const day = d.getDate();
return `${m}/${day}`;
};
const BentoTrend = ({ const BentoTrend = ({
dailyStats = [], dailyStats = [],
@ -81,9 +85,9 @@ const BentoTrend = ({
? 'font-semibold text-slate-900 dark:text-white' ? 'font-semibold text-slate-900 dark:text-white'
: 'text-slate-300 dark:text-white/30' : 'text-slate-300 dark:text-white/30'
}`} }`}
title={`${WEEKDAYS_SHORT[d.date.getDay()]} ${d.count}`} title={`${d.date.getMonth() + 1}${d.date.getDate()} ${d.count}`}
> >
{WEEKDAYS_SHORT[d.date.getDay()]} {formatMD(d.date)}
</span> </span>
))} ))}
</div> </div>