aboutsummaryrefslogtreecommitdiffstats
path: root/skate
diff options
context:
space:
mode:
Diffstat (limited to 'skate')
-rw-r--r--skate/reduce.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/skate/reduce.go b/skate/reduce.go
index 9527974..e03bea1 100644
--- a/skate/reduce.go
+++ b/skate/reduce.go
@@ -35,8 +35,13 @@ import (
"github.com/segmentio/encoding/json"
)
-// timeNow is used for mocking time in tests.
-var timeNow = time.Now
+var (
+ // timeNow is used for mocking time in tests.
+ timeNow = time.Now
+ // a few sane dates to accept
+ minDate = 1500
+ maxDate = time.Now().AddDate(5, 0, 0).Year()
+)
// groupLogf logs a message alongsize a serialized group for debugging.
func groupLogf(g *zipkey.Group, s string, vs ...interface{}) {
@@ -584,7 +589,7 @@ func matchedRefsExtend(matched []*BiblioRef, refs []*Ref, stats *statsAugment) [
isbn = r.Biblio.Extra.ISBN[0]
}
// TODO: need to update this "max year" number frequently?
- if r.Biblio.Year > 1500 && r.Biblio.Year <= 2025 {
+ if r.Biblio.Year > minDate && r.Biblio.Year <= maxDate {
issued = &CSLDate{Parts: [][]int{{int(r.Biblio.Year)}}}
} else {
issued = &CSLDate{}