spruce/internal/templateFuncs/withindaterange.go

24 lines
417 B
Go
Raw Permalink Normal View History

package templates
import (
"time"
"codeflow.dananglin.me.uk/apollo/spruce/internal/cv"
)
// WithinTimePeriod returns true if the employment's end date is within
// the specified time period.
func WithinTimePeriod(t time.Time) func(d cv.Duration) bool {
return func(d cv.Duration) bool {
if d.Present {
return true
}
result, err := d.After(t)
if err != nil {
return false
}
return result
}
}