2013-07-04 22:42:49 +04:00
|
|
|
/*globals Handlebars, moment
|
|
|
|
*/
|
|
|
|
(function () {
|
|
|
|
"use strict";
|
2013-08-22 23:42:54 +04:00
|
|
|
Handlebars.registerHelper('date', function (context, block) {
|
2013-07-04 22:42:49 +04:00
|
|
|
var f = block.hash.format || "MMM Do, YYYY",
|
|
|
|
timeago = block.hash.timeago,
|
|
|
|
date;
|
|
|
|
if (timeago) {
|
|
|
|
date = moment(context).fromNow();
|
|
|
|
} else {
|
|
|
|
date = moment(context).format(f);
|
|
|
|
}
|
|
|
|
return date;
|
|
|
|
});
|
|
|
|
}());
|