From c95b6a7607509eac90ef91420538fca8b0468fbb Mon Sep 17 00:00:00 2001 From: Shahzaib Ali Date: Thu, 11 Dec 2025 21:55:28 +0500 Subject: [PATCH] [Bug]: Invalid leap day (2100-02-29) accepted and converted to timestamp. --- client/src/pages/tools/date-converter.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/src/pages/tools/date-converter.tsx b/client/src/pages/tools/date-converter.tsx index 67135cc3..01a01d46 100644 --- a/client/src/pages/tools/date-converter.tsx +++ b/client/src/pages/tools/date-converter.tsx @@ -183,6 +183,17 @@ export default function DateConverter() { // Try standard date parsing const date = new Date(input); + if (/^\d{4}-\d{2}-\d{2}$/.test(input)) { + const [y, m, d] = input.split("-").map(Number); + + if ( + date.getUTCFullYear() !== y || + date.getUTCMonth() + 1 !== m || + date.getUTCDate() !== d + ) { + return null; + } + } return isNaN(date.getTime()) ? null : date; };