You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
474 B
20 lines
474 B
10 years ago
|
'use strict';
|
||
|
define(
|
||
|
[
|
||
|
'handlebars'
|
||
|
], function (Handlebars) {
|
||
|
|
||
|
Handlebars.registerHelper('historyAge', function () {
|
||
|
|
||
|
var unit = 'days';
|
||
|
var age = this.age;
|
||
|
|
||
|
if (age < 2) {
|
||
|
unit = 'hours';
|
||
|
age = parseFloat(this.ageHours).toFixed(1);
|
||
|
}
|
||
|
|
||
|
return new Handlebars.SafeString('<dt>Age (when grabbed):</dt><dd>{0} {1}</dd>'.format(age, unit));
|
||
|
});
|
||
|
});
|