I have an array of
struct {
Date time.Time
PostedSample int
}
loaded from the appengine datastore which I want to output in a html/template for the Google Visualization Time Line. First I tried formatting the Date directly in the template with {{.Date.Format "new Date(2006,1,2,15,4,5)"}} but html/template escapes this so it appears as a quoted string in the html source. I then tried formatting the date into a []struct{Date template.JS; Value template.JS} with the expression template.JS(m.Date.Format("new Date(2006,1,2,15,4,5)")) which almost works except the month is off by one, javascript wants January as 0. I could have the template generate a json of date parameters and write javascript turn that into Date objects or have go code which adjusts the template output. Please share a more elegant solution. Thank you.