javascript - Week schedule in FullCalendar -
i building scheduling application university, , view deals classes have dayindicator, starttime, , endtime. example of class:
{ title: 'chemistry', dayindicator: '0101010', starttime: '08:00', endtime: '08:50' }
this needs broken 3 events on monday, wednesday, , friday (translation of 0101010). don't have dates imply repetition throughout semester.
this weekly schedule week in entire semester. there way display such events without having worry date?
i know can create moment() object, calculate day offset determine date, set hours , minutes, , set 'start' property, thats pain. wondering if there simple more straightforward way. thanks.
for interested, ended doing:
classes.foreach(function(class) { var dayarray = class.dayindicator.split(''); var start = class.starttime.split(':').map(number); var end = class.endtime.split(':').map(number); dayarray.foreach(function(d,i) { if (d === '1') { scope._scheduledactivities.push({ title: class.title, start: moment().day(i).hour(start[0]).minute(start[1]), end: moment().day(i).hour(end[0]).minute(end[1]) }); } }); });
Comments
Post a Comment