func (p GTLDPeriod) Valid(when time.Time) error {
	// NOTE: We can throw away the errors from time.Parse in this function because
	// the zlint-gtld-update command only writes entries to the generated gTLD map
	// after the dates have been verified as parseable
	notBefore, _ := time.Parse(GTLDPeriodDateFormat, p.DelegationDate)
	if when.Before(notBefore) {
		return fmt.Errorf(`gTLD ".%s" is not valid until %s`,
			p.GTLD, p.DelegationDate)
	}
	// The removal date may be empty. We only need to check `when` against the
	// removal when it isn't empty
	if p.RemovalDate != "" {
		notAfter, _ := time.Parse(GTLDPeriodDateFormat, p.RemovalDate)
		if when.After(notAfter) {
			return fmt.Errorf(`gTLD ".%s" is not valid after %s`,
				p.GTLD, p.RemovalDate)
		}
	}
	return nil
}
func (p GTLDPeriod) Valid(when time.Time) error {
	
	
	
	notBefore, _ := time.Parse(GTLDPeriodDateFormat, p.DelegationDate)
	if when.Before(notBefore) {
		return fmt.Errorf(`gTLD ".%s" is not valid until %s`,
			p.GTLD, p.DelegationDate)
	}
	
	
	if p.RemovalDate != "" {
		notAfter, _ := time.Parse(GTLDPeriodDateFormat, p.RemovalDate)
		if when.After(notAfter) {
			return fmt.Errorf(`gTLD ".%s" is not valid after %s`,
				p.GTLD, p.RemovalDate)
		}
	}
	return nil
}
func ( p GTLDPeriod ) Valid ( when time . Time ) error { // NOTE: We can throw away the errors from time.Parse in this function because // the zlint-gtld-update command only writes entries to the generated gTLD map // after the dates have been verified as parseable notBefore , _ := time . Parse ( GTLDPeriodDateFormat , p . DelegationDate ) if when . Before ( notBefore ) { return fmt . Errorf ( `gTLD ".%s" is not valid until %s` , p . GTLD , p . DelegationDate ) } // The removal date may be empty. We only need to check `when` against the // removal when it isn't empty if p . RemovalDate != " " { notAfter , _ := time . Parse ( GTLDPeriodDateFormat , p . RemovalDate ) if when . After ( notAfter ) { return fmt . Errorf ( `gTLD ".%s" is not valid after %s` , p . GTLD , p . RemovalDate ) } } return nil }
// Valid determines if the provided `when` time is within the GTLDPeriod for the
// gTLD. E.g. whether a certificate issued at `when` with a subject identifier
// using the specified gTLD can be considered a valid use of the gTLD.
Valid determines if the provided when time is within the GTLDPeriod for the gTLD . E . g . whether a certificate issued at when with a subject identifier using the specified gTLD can be considered a valid use of the gTLD .