.Now.AddDate using front matter Param fails with: expected int; got int64

I’m attempting to generate an adaptive index of monthly calendars from predefined pages in a series. The link titles are determined at build time based on an offset value in the front matter of each page:

{{ $name := "calendar" }}
{{ $series := index .Site.Taxonomies.series $name }}
{{ range $series.Pages }}
    {{ $title := .Now.AddDate 0 .Params.offset 0 | dateFormat "January 2006" }}
<dt><a href="{{ .Permalink }}">{{ $title }}</a></dt>
{{ end }}

This fails to build:

ERROR: 2016/01/15 Error while rendering section calendar:
template: section/calendar.html:19:41: executing "section/calendar.html"
at <.Params.offset>: wrong type for value; expected int; got int64`

Using {{ .Now.AddDate 0 1 0 | dateFormat "January 2006" }} in my template produces the expected result (i.e. “next month” “this year”).

Can anyone suggest a way to convert an int64 to an int?

Only in a slightly hackish way:

 {{ $title := .Now.AddDate 0 (add .Params.offset 0) 0 | dateFormat "January 2006" }}

Thanks for your suggestion. Unfortunately it did not resolve the issue I’m experiencing.

The error message did change a bit:

ERROR: 2016/01/15 15:44:57 general.go:203: Error while rendering section calendar:
template: section/calendar.html:18:55: executing "section/calendar.html" at <0>:
wrong type for value; expected int; got int64

The error is now occurring at the second argument to the add function (regardless of the order of the arguments.)

I tried your suggestion using go 1.3.3 and hugo 0.16-dev (from the beginning of December 2015). Then I updated go (to 1.5.1), rebuilt hugo (using go get -u -v …), and tried again. Both versions are reporting this error.

OK, I was wrong – but as this and the string counterpart is one of the common questions here:

That solved my problem.

I used (int .Params.offset) in my .AddDate call and there were no more int64 problems.

Thanks for taking the time to fix this issue so quickly.