From 6527c13b5b57b315b3fc3306d54b5770447fbb19 Mon Sep 17 00:00:00 2001 From: Heer Panchal Date: Fri, 15 May 2026 14:34:15 +0530 Subject: [PATCH] feat: detect inconsistent date formats in CV evaluation --- packages/core/src/evaluator/index.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/core/src/evaluator/index.ts b/packages/core/src/evaluator/index.ts index 8998979..feb337c 100644 --- a/packages/core/src/evaluator/index.ts +++ b/packages/core/src/evaluator/index.ts @@ -185,6 +185,30 @@ function findIssues(cv: string, archetype: RoleArchetype) { } } + const DATE_FORMAT_PATTERNS = [ + { type: "YYYY-MM", regex: /\b\d{4}-\d{2}\b/ }, + { type: "MM-YYYY", regex: /\b\d{2}-\d{4}\b/ }, + { type: "YYYY-YYYY", regex: /\b\d{4}\s*-\s*\d{4}\b/ }, + { type: "Mon YYYY", regex: /\b(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d{4}\b/i } + ]; + + const formats = new Set(); + + for (const { type, regex } of DATE_FORMAT_PATTERNS) { + if (regex.test(cv)) { + formats.add(type); + } + } + + if (formats.size > 1) { + issues.push({ + element: "Inconsistent date formats", + why: `Multiple formats detected: ${[...formats].join(", ")}`, + fix: "Use a consistent format throughout. Recommended: Mon YYYY (e.g., Jan 2022).", + severity: "minor", + }); + } + return issues; } @@ -225,4 +249,4 @@ function extractKeywords(jd: string): string[] { .filter((w) => w.length > 2 && !stopWords.has(w)); return [...new Set(words)]; -} +} \ No newline at end of file