added more precise distance values (at least three digits of precision)
This commit is contained in:
parent
6a9216d6e4
commit
acdfa546a8
@ -46,7 +46,10 @@ function secondsToTime(seconds){
|
|||||||
// human readable distance
|
// human readable distance
|
||||||
function getDistanceWithUnit(distance){
|
function getDistanceWithUnit(distance){
|
||||||
distance = parseInt(distance);
|
distance = parseInt(distance);
|
||||||
if(distance >= 1000){ return (parseInt(distance/1000))+' ' + 'km'; }
|
|
||||||
|
if(distance >= 100000){ return (parseInt(distance/1000))+' ' + 'km'; }
|
||||||
|
else if(distance >= 10000){ return (parseInt(distance/1000).toFixed(1))+' ' + 'km'; }
|
||||||
|
else if(distance >= 1000){ return (parseFloat(distance/1000).toFixed(2))+' ' + 'km'; }
|
||||||
else{ return distance+' ' + 'm'; }
|
else{ return distance+' ' + 'm'; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user