For convert time string, skip convert if incoming value is a number of any type

Any float number will be rounded, and everything that is any kind of number will be then converted to int and returned
The rest will be converted to string and normal convert is run
This commit is contained in:
Clemens Schwaighofer
2025-07-29 09:28:37 +09:00
parent 12af1c80dc
commit 2f08ecabbf
3 changed files with 16 additions and 2 deletions

View File

@@ -31,6 +31,13 @@ def main() -> None:
"30m 45 minutes", # minutes appears twice
"1Y 2 years", # years appears twice
"1x 2 yrs", # invalid names
123, # int
789.12, # float
456.56, # float, high
"4566", # int as string
"5551.12", # float as string
"5551.56", # float, high as string
]
for time_string in test_cases: