Merge pull request #5586 from mempool/natsoni/search-bar-seconds
Include optional seconds in search bar date
This commit is contained in:
commit
5b557b2c12
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user