This commit is contained in:
oneao committed 2026-02-25 17:31:09 +08:00
1 parent 835958886e
commit d04d22723b
155 files changed
+543 -9793

No files matched your search

@@ -1,29 +0,0 @@
package timex
import (
"fmt"
"time"
)
func ParseTimeFlexible(value string) (*time.Time, error) {
if value == "" {
return nil, nil // ⭐ 空字符串 → 不限时间
}
layouts := []string{
"2006-01-02 15:04:05",
"2006-01-02 15:04",
"2006-01-02",
"2006-01",
time.RFC3339,
}
for _, layout := range layouts {
t, err := time.Parse(layout, value)
if err == nil {
return &t, nil
}
}
return nil, fmt.Errorf("unsupported time format: %s", value)
}