Dan Anglin
fa8dbe68e9
Allow users to limit the amount of employment history shown in the PDF document by specifying a time range. This is a breaking change as the structure of the CV needs to slightly change. The employment's start and end dates need to be represented as integers. Additional refactoring: - The CV type is now in the internal cv package. - The template functions are now in the internal templateFuncs package.
23 lines
417 B
Go
23 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
|
|
}
|
|
}
|