mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 16:01:40 +03:00
17 lines
427 B
JavaScript
17 lines
427 B
JavaScript
|
/*globals Handlebars, moment
|
||
|
*/
|
||
|
(function () {
|
||
|
"use strict";
|
||
|
Handlebars.registerHelper('dateFormat', function (context, block) {
|
||
|
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;
|
||
|
});
|
||
|
}());
|