2013-06-22 06:24:24 +00:00
|
|
|
'use strict';
|
2013-06-21 00:06:56 +00:00
|
|
|
define(
|
|
|
|
[
|
2013-06-25 04:43:16 +00:00
|
|
|
'handlebars',
|
2013-06-21 00:06:56 +00:00
|
|
|
'sugar'
|
2013-06-25 04:43:16 +00:00
|
|
|
], function (Handlebars) {
|
|
|
|
Handlebars.registerHelper('ShortDate', function (input) {
|
|
|
|
if (!input) {
|
|
|
|
return '';
|
|
|
|
}
|
2013-06-21 00:06:56 +00:00
|
|
|
|
2013-06-25 04:43:16 +00:00
|
|
|
var date = Date.create(input);
|
|
|
|
var result = '<span title="' + date.full() + '">' + date.short() + '</span>';
|
2013-06-21 00:06:56 +00:00
|
|
|
|
2013-06-25 04:43:16 +00:00
|
|
|
return new Handlebars.SafeString(result);
|
|
|
|
});
|
2013-07-17 00:41:04 +00:00
|
|
|
|
|
|
|
Handlebars.registerHelper('Day', function (input) {
|
|
|
|
if (!input) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
return Date.create(input).format('{dd}');
|
|
|
|
});
|
|
|
|
|
|
|
|
Handlebars.registerHelper('Month', function (input) {
|
|
|
|
if (!input) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
return Date.create(input).format('{Mon}');
|
|
|
|
});
|
|
|
|
|
|
|
|
Handlebars.registerHelper('StartTime', function (input) {
|
|
|
|
if (!input) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
var date = Date.create(input);
|
|
|
|
if (date.format('{mm}') === '00') {
|
|
|
|
return date.format('{h}{tt}');
|
|
|
|
}
|
|
|
|
|
|
|
|
return date.format('{h}.{mm}{tt}');
|
|
|
|
});
|
2013-06-21 00:06:56 +00:00
|
|
|
});
|