asaskevich / govalidator

[Go] Package of validators and sanitizers for strings, numerics, slices and structs
MIT License
5.97k stars 554 forks source link

Validate time duration strings #474

Closed jirevwe closed 2 years ago

jirevwe commented 2 years ago

Feature Request

Q A
New Feature yes
RFC yes
BC Break no

Summary

Validate time duration strings. Strings like 1h2m are valid time durations but today I have to use alphanum validate it and then use time.ParseDuration() in my code to check if it's a valid time duration.

I'm happy to work on it and submit a PR.