fix: correct off-by-one in comparison period label

This commit is contained in:
Usman Baig
2026-03-11 23:23:39 +01:00
parent 1c5ca7fa54
commit 34eca64967

View File

@@ -359,8 +359,8 @@ export default function Chart({
)}
</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`
const days = Math.round((new Date(dateRange.end).getTime() - new Date(dateRange.start).getTime()) / 86400000)
return days === 0 ? 'vs yesterday' : `vs previous ${days} days`
})()}</div>
{metric === m.key && (
<div className="absolute bottom-0 left-0 right-0 h-0.5 bg-brand-orange" />