Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (24 sloc) 605 Bytes
package validators
import (
type TimeAfterTime struct {
FirstName string
FirstTime time.Time
SecondName string
SecondTime time.Time
Message string
// IsValid adds an error if the FirstTime is not after the SecondTime.
func (v *TimeAfterTime) IsValid(errors *validate.Errors) {
if v.FirstTime.UnixNano() >= v.SecondTime.UnixNano() {
if len(v.Message) > 0 {
errors.Add(GenerateKey(v.FirstName), v.Message)
errors.Add(GenerateKey(v.FirstName), fmt.Sprintf("%s must be after %s.", v.FirstName, v.SecondName))
You can’t perform that action at this time.