24 lines
417 B
Go
24 lines
417 B
Go
|
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
|
||
|
}
|
||
|
}
|