v9
I read the documentation and used ctrl+f to search the functions about date but couldn't find anything like this.
What I'm trying to do is to validate the birthday of the user, which means the year of the birthdate must be lesser or equals the current year, and the days must be matched with it's month, there's even a Leap year would need to care about, what I can do is to handle this part manually, but I'd be glad to see it as a feature of validator, thanks.
Hey @YamiOdymel
that seems like a good and very common validation to have, if you could provide some sample code of how you are doing it manually I would definitely add it as one of the baked in validations :)
Sorry that I'm writing the front-end and the API documentation recently, I'll post the code once I back to develop the backend.
Thanks @YamiOdymel
No problem, I am busy also or would take a stab at it myself
it would be great to add validation for weekdays
Hey @mehdy
Would you be able to provide and example of how/when this validation would be used?
hey @joeybloggs
ofc, I'm dealing with some sort of events which has some fields that determines the weekdays.
I'm using this alias now. but I think it would be much better to be implemented with switch/case
validate.RegisterAlias("isweekday", "eq=SAT|eq=SUN|eq=MON|eq=TUE|eq=WED|eq=THU|eq=FRI")
@mehdy ok I see
I don't think I'd want to add that to the built in validations, only because it is a pretty specific validation case, I only add ones to the core that everyone would use the same way.(I really need to create a separate repo for validations that aren't in the core so people can register then as needed)
But you could also implement this as a custom validation and replace the alias, then you could use a switch. https://godoc.org/gopkg.in/go-playground/validator.v9#Validate.RegisterValidation
Most helpful comment
Thanks @YamiOdymel
No problem, I am busy also or would take a stab at it myself