@@ -451,13 +451,12 @@ function checkClassTime(classPeriod) {
451451 * @param {* } time the time that you want to calculate the delta to from the current time
452452 * @returns the absolute value of the difference between the given time and the current time as an object
453453 */
454- function getTimeDelta ( time ) {
455- var currentTimeObject = getCurrentTimeObject ( ) ;
456- var currentTime = new Date ( 2000 , 0 , 1 , currentTimeObject . hours , currentTimeObject . minutes , currentTimeObject . seconds ) ;
457- var givenTime = new Date ( 2000 , 0 , 1 , time . hours , time . minutes , 0 ) ;
454+ function getTimeDelta ( timeObject1 , timeObject2 ) {
455+ var time1 = new Date ( 2000 , 0 , 1 , timeObject1 . hours , timeObject1 . minutes , timeObject1 . seconds ) ;
456+ var time2 = new Date ( 2000 , 0 , 1 , timeObject2 . hours , timeObject2 . minutes , timeObject2 . seconds ) ;
458457
459458 //order doesnt matter
460- return convertMillisecondsToTime ( Math . abs ( givenTime - currentTime ) ) ;
459+ return convertMillisecondsToTime ( Math . abs ( time1 - time2 ) ) ;
461460}
462461
463462
@@ -508,7 +507,7 @@ function convertMillisecondsToTime(milliseconds) {
508507 */
509508function getTimeToEndOfCurrentClassString ( ) {
510509 if ( classIsInSession ( ) ) {
511- return getTimeStringFromObject ( getTimeDelta ( schools [ selectedSchoolIndex ] . schedules [ currentScheduleIndex ] . classes [ currentClassPeriodIndex ] . endTime ) ) ;
510+ return getTimeStringFromObject ( getTimeDelta ( getCurrentTimeObject ( ) , schools [ selectedSchoolIndex ] . schedules [ currentScheduleIndex ] . classes [ currentClassPeriodIndex ] . endTime ) ) ;
512511 } else {
513512 return "No Class"
514513 }
@@ -520,7 +519,7 @@ function getTimeToEndOfCurrentClassString() {
520519 */
521520function getTimeToStartOfSchoolString ( ) {
522521 if ( ! classIsInSession ( ) && ! isNoSchoolDay ( ) && compareTimes ( getCurrentTimeObject ( ) , schools [ selectedSchoolIndex ] . schedules [ currentScheduleIndex ] . classes [ 0 ] . startTime ) == - 1 ) {
523- return getTimeStringFromObject ( getTimeDelta ( schools [ selectedSchoolIndex ] . schedules [ currentScheduleIndex ] . classes [ 0 ] . startTime ) ) ;
522+ return getTimeStringFromObject ( getTimeDelta ( getCurrentTimeObject ( ) , schools [ selectedSchoolIndex ] . schedules [ currentScheduleIndex ] . classes [ 0 ] . startTime ) ) ;
524523 } else {
525524 return "No Class"
526525 }
0 commit comments