fix: show dynamic comparison period label in stat headers

This commit is contained in:
Usman Baig
2026-03-11 23:14:35 +01:00
parent 73db65c0b2
commit 275503ae8f

View File

@@ -358,7 +358,10 @@ export default function Chart({
</span> </span>
)} )}
</div> </div>
<div className="text-xs text-neutral-400 dark:text-neutral-500 mt-1">vs yesterday</div> <div className="text-xs text-neutral-400 dark:text-neutral-500 mt-1">{(() => {
const days = Math.round((new Date(dateRange.end).getTime() - new Date(dateRange.start).getTime()) / 86400000) + 1
return days <= 1 ? 'vs yesterday' : `vs previous ${days} days`
})()}</div>
{metric === m.key && ( {metric === m.key && (
<div className="absolute bottom-0 left-0 right-0 h-0.5 bg-brand-orange" /> <div className="absolute bottom-0 left-0 right-0 h-0.5 bg-brand-orange" />
)} )}