Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

Add null guard for applied date

Khuram Niazf8a8db831f80
diff --git a/src/actions/dashboard.actions.ts b/src/actions/dashboard.actions.ts
index 8056015..5a6060d 100644
--- a/src/actions/dashboard.actions.ts
+++ b/src/actions/dashboard.actions.ts
@@ -197,6 +197,7 @@ export const getJobsActivityForPeriod = async (): Promise<any | undefined> => {
});
// Reduce to a format that groups by unique date (YYYY-MM-DD) using local time
const groupedPosts = jobData.reduce((acc: any, post: any) => {
+ if (!post.appliedDate) return acc;
const date = format(new Date(post.appliedDate), "yyyy-MM-dd");
acc[date] = (acc[date] || 0) + post._count._all;
return acc;
@@ -377,6 +378,7 @@ export const getActivityCalendarData = async (): Promise<any | undefined> => {
// Reduce to a format that groups by unique date (YYYY-MM-DD)
const groupedJobs = jobData.reduce((acc: any, job: any) => {
+ if (!job.appliedDate) return acc;
const date = format(new Date(job.appliedDate), "yyyy-MM-dd");
acc[date] = (acc[date] || 0) + job._count._all;
return acc;
diff --git a/src/components/dashboard/RecentCardToggle.tsx b/src/components/dashboard/RecentCardToggle.tsx
index e1e858b..df35331 100644
--- a/src/components/dashboard/RecentCardToggle.tsx
+++ b/src/components/dashboard/RecentCardToggle.tsx
@@ -84,7 +84,7 @@ export default function RecentCardToggle({
</div>
</Link>
<div className="ml-auto text-sm font-medium">
- {format(job?.appliedDate, "PP")}
+ {job?.appliedDate ? format(job.appliedDate, "PP") : "N/A"}
</div>
</div>
))