[PTRun][TimeDate]Unix Time in milliseconds, fix negative unix time input, error message improvement (#29149)

* add unix time in ms

* update dev docs

* unit tests

* fix spell check

* tool tip

* fix negative unix time input, improve regex, update unit tests, improve error message

* Update error handling and tests

* add tests and fix spelling

* small fixes
This commit is contained in:
Heiko
2023-10-18 11:45:00 +02:00
committed by GitHub
parent cd99a2e848
commit 50cb279d2a
11 changed files with 94 additions and 29 deletions

View File

@@ -121,8 +121,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.Components
}
// If search term is only a number that can't be parsed return an error message
if (!isEmptySearchInput && results.Count == 0 && searchTerm.Any(char.IsNumber) && Regex.IsMatch(searchTerm, @"\w+\d+$") &&
!searchTerm.Contains(InputDelimiter) && !searchTerm.Any(char.IsWhiteSpace) && !searchTerm.Any(char.IsPunctuation))
if (!isEmptySearchInput && results.Count == 0 && Regex.IsMatch(searchTerm, @"\w+\d+.*$") && !searchTerm.Any(char.IsWhiteSpace) && (TimeAndDateHelper.IsSpecialInputParsing(searchTerm) || !Regex.IsMatch(searchTerm, @"\d+[\.:/]\d+")))
{
// Without plugin key word show only if message is not hidden by setting
if (isKeywordSearch || !TimeDateSettings.Instance.HideNumberMessageOnGlobalQuery)