Token 使用趋势 X 轴标签从星期改为具体日期(月/日 格式)
This commit is contained in:
parent
6a99f229e3
commit
847c2bd9d3
|
|
@ -22,7 +22,11 @@ import { TrendingUp } from 'lucide-react';
|
|||
import Sparkline from './Sparkline';
|
||||
import { renderQuota } from '../../helpers';
|
||||
|
||||
const WEEKDAYS_SHORT = ['日', '一', '二', '三', '四', '五', '六'];
|
||||
const formatMD = (d) => {
|
||||
const m = d.getMonth() + 1;
|
||||
const day = d.getDate();
|
||||
return `${m}/${day}`;
|
||||
};
|
||||
|
||||
const BentoTrend = ({
|
||||
dailyStats = [],
|
||||
|
|
@ -81,9 +85,9 @@ const BentoTrend = ({
|
|||
? 'font-semibold text-slate-900 dark:text-white'
|
||||
: '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>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue