Skip to content

Commit 799d651

Browse files
calculate.ts updated
1 parent a0b3c16 commit 799d651

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎lib/calculate.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,25 @@ export function calculateStreak(
315315
} else {
316316
currentStreak = 0;
317317
}
318+
let resolvedTodayDate = localTodayStr;
319+
const hasTodayEntry = nonVacationUniqueDays.some((d) => d.date === effectiveTodayStr);
320+
321+
// Only fallback if calendar has no entry for today at all
322+
if (!hasTodayEntry && isStreakAlive) {
323+
const lastActive = nonVacationUniqueDays
324+
.slice(0, evaluationIndex + 1)
325+
.reverse()
326+
.find((d) => d.contributionCount > 0);
327+
if (lastActive) {
328+
resolvedTodayDate = lastActive.date;
329+
}
330+
}
318331

319332
return {
320333
currentStreak,
321334
longestStreak,
322335
totalContributions: calendar.totalContributions || 0,
323-
todayDate: localTodayStr,
336+
todayDate: resolvedTodayDate,
324337
};
325338
}
326339

0 commit comments

Comments
 (0)