From: Bastian Dehn Date: Tue, 11 Nov 2025 17:58:34 +0000 (+0100) Subject: fix date length regex X-Git-Tag: 1.3.8^2~6^2~1 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=0a175ae92c9b247862c4cfbb41335fe1d888ac24;p=feierabend.git fix date length regex --- diff --git a/src/time_format.c b/src/time_format.c index c49f3d6..cc862a2 100644 --- a/src/time_format.c +++ b/src/time_format.c @@ -10,7 +10,7 @@ #define SHORT_WEEKDAY_STR_LEN 3 #define MAX_TIME_STR_LENGTH 7 -#define DATE_REGEX "[0-9]{4}-([0][1-9]|1[0-2])-([0-2][1-9]|[1-3]0|3[01])" +#define DATE_REGEX "^[0-9]{4}-([0][1-9]|1[0-2])-([0-2][1-9]|[1-3]0|3[01])$" void get_time_str(time_t timediff, char* timestr) { diff --git a/tests/time_format_tests.c b/tests/time_format_tests.c index a6a8d78..0937a80 100644 --- a/tests/time_format_tests.c +++ b/tests/time_format_tests.c @@ -362,6 +362,7 @@ void validate_invalid_date_string_tests() validate_invalid_date_string("2025-01--1"); validate_invalid_date_string("2025-001-01"); validate_invalid_date_string("2025-001-011"); + validate_invalid_date_string("20255-01-11"); } int main()