fixes "`year` is not defined"

can you update the PR and make sure we have a unit test that catches the problem to avoid regressions? if you don't have the time that is OK, I can do it later.