nl_tokens: Get the time difference between two timestrings .
pl_tokens: function getTimeDifference ( timestr1 , timestr2 ) { if ( typeof timestr1 !== 'string' || typeof timestr2 !== 'string' ) { throw new Error ( 'pendel.time() expects string arguments' ) ; } // Check if we are getting the short timecode formats // like 1:32PM or 13:32. If Yes, convert it into a // generic datestring so that we can support the old API. var date1 = shortTimeToDateString ( timestr1 ) ; var date2 = shortTimeToDateString ( timestr2 ) ; if ( ! date1 ) { date1 = new Date ( timestr1 ) . toString ( ) ; } if ( ! date2 ) { date2 = new <mask> ( timestr2 ) . toString ( ) ; } var time1 = dateComponents ( date1 ) ; var time2 = dateComponents ( date2 ) ; var results = getTotalResultsFromEpochs ( time1 . epoch , time2 . epoch ) ; return { hours : Math . floor ( results . totalSeconds / 60 / 60 ) , minutes : Math . floor ( ( results . totalSeconds / 60 ) % 60 ) , seconds : Math . floor ( results . totalSeconds % 60 ) , totalMinutes : results . totalMinutes , totalSeconds : results . totalSeconds } ; }