Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Example custom template tag for jQuery Templates plugin ($.tmpl)
// Relevant jQuery Template source:
// https://github.com/jquery/jquery-tmpl/blob/master/jquery.tmpl.js#L206
// Example usage: {{pretty_datetime some.date.obj}}
$.extend(jQuery.tmpl.tag, {
"pretty_datetime": {
open: "if($notnull_1){_.push(pretty_datetime($1a));}"
}
});
function pretty_datetime(date) {
/* do something to date */
return date;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment