From b767791f42252a196820ae7d6a5f1e269f479fa3 Mon Sep 17 00:00:00 2001 From: Shivam Date: Sun, 24 May 2026 16:40:29 +0530 Subject: [PATCH] fix: handle 'end of year' phrase in NLP fallback --- server.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server.js b/server.js index 47e1429..c187f74 100644 --- a/server.js +++ b/server.js @@ -131,6 +131,9 @@ function nlpExtractDate(text, now = new Date()) { if (/\bend of (the\s+)?month\b/.test(lower)) { return nlpStartOf(new Date(now.getFullYear(), now.getMonth() + 1, 0)).toISOString(); } + if (/\bend of (the\s+)?year\b/.test(lower)) { + return nlpStartOf(new Date(now.getFullYear(), 11, 31)).toISOString(); + } if (/\bnext month\b/.test(lower)) { const d = new Date(now); d.setMonth(d.getMonth() + 1); return nlpStartOf(d).toISOString();