This commit is contained in:
2025-03-31 17:36:49 +08:00
parent 490630d4c9
commit d7183fcc00
805 changed files with 1055 additions and 304753 deletions

View File

@@ -3,6 +3,7 @@ package convertor
import (
"net/url"
"strconv"
"time"
)
func ConvertInt[T int | int16 | int32 | int64](value string, defaultValue T) T {
@@ -35,3 +36,13 @@ func QueryInt[T int | int16 | int32 | int64](vars url.Values, key string, defaul
return T(i)
}
func DefaultStartTimeAndEndTime(start string, end string) (string, string) {
if len(start) == 0 {
start = "2000-01-01 00:00:00"
}
if len(end) == 0 {
end = time.Now().Add(time.Hour * 24).Format(time.DateTime)
}
return start, end
}