Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var FirstTime = container.find('#1time').val();
- var SecondTime = container.find('#2time').val();
- var busyTimes = [];
- busyTimes = getBusyTimes(FirstTime , SecondTime);
- function getBusyTimes(first, second) {
- var f = first.split(' '), s = second.split(' ');
- if (first == '12.00 AM') f[0] = '0';
- if (first == '12.00 PM') f[1] = 'AM';
- if (second == '12.00 AM') s[0] = '24';
- if (second == '12.00 PM') s[1] = 'AM';
- f[0] = parseInt(f[0], 10) + (f[1] == 'PM' ? 12 : 0);
- s[0] = parseInt(s[0], 10) + (s[1] == 'PM' ? 12 : 0);
- int i = s[0] - f[0];
- // I have difference in hours in "i"
- //From here, I want to make use of value 'i' -- calculate in between
- // hourly values and return the array back to
- // original function above.
- }
- function getBusyTimes(first, second){
- var timeList = ['12:00 AM','1:00 AM','2:00 AM','3:00 AM']; // finish this list
- var firstid = timeList.indexOf(first);
- var secondid = timeList.indexOf(second);
- var result = new Array();
- for(var i=firstid; i<=secondid; i++ ){
- result.push(timeList[i]);
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement