Open
Description
Package version eg. v8, v9:
v10
Question:
Is there any way to validate struct field of time.Duration
type using this library?
The code sample below throws invalid syntax panic:
panic: strconv.ParseInt: parsing "100ms": invalid syntax
Code sample, to showcase or reproduce:
package main
import (
"fmt"
"time"
"github.com/go-playground/validator/v10"
)
type Config struct {
Interval time.Duration `validate:"required,gte=100ms"`
}
func main() {
config := &Config{
Interval: time.Millisecond,
}
validate := validator.New()
err := validate.Struct(config)
if err != nil {
panic(err)
}
fmt.Println(config)
}