mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 08:32:40 +08:00
fix log output
This commit is contained in:
11
dateconv/duration.go
Normal file
11
dateconv/duration.go
Normal file
@ -0,0 +1,11 @@
|
||||
package dateconv
|
||||
|
||||
import "time"
|
||||
|
||||
func ParseDuration(s string) (time.Duration, error) {
|
||||
if len(s) == 0 {
|
||||
return time.Duration(0), nil
|
||||
}
|
||||
|
||||
return time.ParseDuration(s)
|
||||
}
|
10
dateconv/duration_test.go
Normal file
10
dateconv/duration_test.go
Normal file
@ -0,0 +1,10 @@
|
||||
package dateconv
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParseDuration(t *testing.T) {
|
||||
t.Log(ParseDuration(""))
|
||||
t.Log(ParseDuration("abc"))
|
||||
}
|
Reference in New Issue
Block a user