define([], function () {
function getTimersHtml(timers) {
return new Promise(function (resolve, reject) {
require(['paper-fab', 'paper-item-body', 'paper-icon-item'], function () {
var html = '';
var index = '';
var imgUrl;
for (var i = 0, length = timers.length; i < length; i++) {
var timer = timers[i];
var startDateText = LibraryBrowser.getFutureDateText(parseISO8601Date(timer.StartDate, { toLocal: true }));
if (startDateText != index) {
if (index) {
html += '';
html += '';
}
html += '
';
html += '
' + startDateText + '
';
html += '
';
html += '
';
}
resolve(html);
});
});
}
window.LiveTvHelpers = {
getDaysOfWeek: function () {
var days = [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
];
return days.map(function (d) {
return {
name: d,
value: d
};
});
},
renderOriginalAirDate: function (elem, item) {
var airDate = item.PremiereDate;
if (airDate && item.IsRepeat) {
try {
airDate = parseISO8601Date(airDate, { toLocal: true }).toLocaleDateString();
}
catch (e) {
console.log("Error parsing date: " + airDate);
}
elem.html(Globalize.translate('ValueOriginalAirDate').replace('{0}', airDate)).show();
} else {
elem.hide();
}
},
getTimersHtml: getTimersHtml
};
});