diff --git a/frontend/src/app/shared/regex.utils.ts b/frontend/src/app/shared/regex.utils.ts index a349e9633..b3d277c9f 100644 --- a/frontend/src/app/shared/regex.utils.ts +++ b/frontend/src/app/shared/regex.utils.ts @@ -313,20 +313,24 @@ export function getRegex(type: RegexType, network?: Network): RegExp { } regex += `)`; // End the non-capturing group break; - // Match a date in the format YYYY-MM-DD (optional: HH:MM) + // Match a date in the format YYYY-MM-DD (optional: HH:MM or HH:MM:SS) // [Testing Order]: any order is fine case `date`: regex += `(?:`; // Start a non-capturing group regex += `${NUMBER_CHARS}{4}`; // Exactly 4 digits regex += `[-/]`; // 1 instance of the symbol "-" or "/" - regex += `${NUMBER_CHARS}{1,2}`; // Exactly 4 digits + regex += `${NUMBER_CHARS}{1,2}`; // 1 or 2 digits regex += `[-/]`; // 1 instance of the symbol "-" or "/" - regex += `${NUMBER_CHARS}{1,2}`; // Exactly 4 digits + regex += `${NUMBER_CHARS}{1,2}`; // 1 or 2 digits regex += `(?:`; // Start a non-capturing group regex += ` `; // 1 instance of the symbol " " - regex += `${NUMBER_CHARS}{1,2}`; // Exactly 4 digits + regex += `${NUMBER_CHARS}{1,2}`; // 1 or 2 digits regex += `:`; // 1 instance of the symbol ":" - regex += `${NUMBER_CHARS}{1,2}`; // Exactly 4 digits + regex += `${NUMBER_CHARS}{1,2}`; // 1 or 2 digits + regex += `(?:`; // Start a non-capturing group for optional seconds + regex += `:`; // 1 instance of the symbol ":" + regex += `${NUMBER_CHARS}{1,2}`; // 1 or 2 digits + regex += `)?`; // End the non-capturing group regex += `)?`; // End the non-capturing group. This group appears 0 or 1 times regex += `)`; // End the non-capturing group break;