Added timeDifference js function