Rather than having to hard code the ISO8601 format string throughout my templates, it would be nicer if Freemarker provided a builtin for outputting dates in ISO8601 format. It might be called "?iso" for example. (There's also ?iso
since 2.3.19 or like.)
Logged In: YES
user_id=546667
Originator: NO
Throughout your templates? You should specify the date format only once, and either store it in a variable (so you can just write ${theDate?string(my.iso)}), or write a function that formats the date (like my.iso(theDate)). Or, just set the date_format setting to that format string, if the ISO 8601 format was the preferred (default) format. Does one of these working for you?
Logged In: YES
user_id=7747
Originator: YES
While they're all equally valid approaches they don't really address the basic concern, which is that ISO8601 is a pervasive date/time format and as such it would be ideal if Freemarker had first class support for it, rather than requiring the template developer to do something to be able to use it (regardless of what that "something" is).
I realise this is syntactic sugar, but that precedent has already been established elsewhere (eg. the ?c builtin for numbers).
FreeMarker 2.3.21 has "iso" date/time/dateTime format. It can be used like any other formatting patterns. See: http://freemarker.org/docs/ref_directive_setting.html#topic.dateTimeFormatSettings
Diff: