templatefilters: raise ProgrammingError if unencodable type passed to json()
This shouldn't happen for any template data types (though I know it does
because of some templater bugs.) Let's clarify it is a bug.
templatefilters: declare input type as date where appropriate
I'm not sure if the templateutil.date type can be a thing. Currently it's
just a constant.