diff --git a/src/app/page.tsx b/src/app/page.tsx index 225ef53..64be4f6 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -629,10 +629,18 @@ export default function Home() { }, [selectedTask]) // Get current sprint (across all projects) using local-day boundaries. + // Prioritize date matching - if today falls within sprint dates, it's current const now = new Date() + const sprintsInProgress = sprints.filter((s) => isSprintInProgress(s.startDate, s.endDate, now)) + + // First: prefer active sprints that are in date range + // Second: any sprint in date range (not completed) + // Third: any sprint in date range (even if completed, for edge cases) const currentSprint = - sprints.find((s) => s.status === "active" && isSprintInProgress(s.startDate, s.endDate, now)) ?? - sprints.find((s) => s.status !== "completed" && isSprintInProgress(s.startDate, s.endDate, now)) + sprintsInProgress.find((s) => s.status === "active") ?? + sprintsInProgress.find((s) => s.status !== "completed") ?? + sprintsInProgress[0] ?? + null // Filter tasks to only show current sprint tasks in Kanban (from ALL projects) // Sort by updatedAt descending (latest first)