package tools import ( "log" "testing" "time" ) func TestTimeBefore(t *testing.T) { b := time.Now().Add(1 * time.Second) a := time.Now().Add(2 * time.Second) log.Println(b.Before(a)) } func TestTimeStrToTime(t *testing.T) { ti := TimeStrToTime("2025-12-30") log.Println(ti) } func TestIsWorkTime(t *testing.T) { weekDays := []string{ "星期一", "星期二", "星期五", } monringRange := []string{ "2024-01-01 08:30", "2024-01-01 12:00", } afternoonRange := []string{ "2024-01-01 13:30", "2024-01-01 18:00", } otherRange := []string{ "2024-01-01 08:30", "2024-01-01 12:00", } isWorkTime := IsWorkTime(weekDays, monringRange, afternoonRange, otherRange) log.Println(isWorkTime) } func TestIsInTimeRange(t *testing.T) { isWorkTime := IsInTimeRange("2024-01-01 09:00", "2024-01-01 18:00") log.Println(isWorkTime) isWorkTime = IsInTimeRange("2024-01-01 08:30", "2024-01-01 12:00") log.Println(isWorkTime) }