Skip to content

Instantly share code, notes, and snippets.

@egorvinogradov
Last active August 29, 2015 14:19
Show Gist options
  • Save egorvinogradov/c2bf1370853a386780fe to your computer and use it in GitHub Desktop.
Save egorvinogradov/c2bf1370853a386780fe to your computer and use it in GitHub Desktop.
var daysMapping = {
'M': 'Mon',
'T': 'Tue',
'W': 'Wed',
'Th': 'Thu',
'F': 'Fri',
'Sat': 'Sat',
'Sun': 'Sun',
};
classes = LU.classes.map(function(item){
var days = item.days
.split(/\s+&\s+/)
.map(function(day){
return daysMapping[day];
});
item.days = days;
return item;
});
////
classesTime = LU.classes.map(function(item){
item.time = item.time.split(' – ').map(handleTime).join(' – ');
return item;
});
function handleTime(str){
var num = str.split(':');
var dig = +num[0];
if (dig < 10) {
dig = '0' + dig
}
return dig + ':' + num[1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment