Skip to content

Instantly share code, notes, and snippets.

@tkh44
Created August 9, 2013 20:59
Show Gist options
  • Save tkh44/6197139 to your computer and use it in GitHub Desktop.
Save tkh44/6197139 to your computer and use it in GitHub Desktop.
renderTime
renderTimeBlocks: function(timeBlocks, cb) {
var self = this,
startOfWeek = moment().startOf('week'),
endOfWeek = moment().endOf('week'),
startOfNextWeek = moment().add('w', 1).startOf('week'),
endOfNextWeek = moment().add('w', 1).endOf('week'),
thisWeekFormat = 'This Week ' + startOfWeek.format('MM/DD') + '-' + endOfWeek.format('MM/DD'),
nextWeekFormat = 'Next Week ' + startOfNextWeek.format('MM/DD') + '-' + endOfNextWeek.format('MM/DD'),
timeBlockKeys = ['Today', thisWeekFormat, nextWeekFormat, 'Upcoming'];
_.each(timeBlockKeys, function(element, index, list) {
if (timeBlocks[element]) {
self.timeBlock.append('TimeBlockItem', {
timeBlock: element,
reservations: timeBlocks[element]
});
}
});
cb.apply(this);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment