]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/routing.js.erb
Merge pull request #18 from danstowell/jsrouting-durationcalc
[rails.git] / app / assets / javascripts / routing.js.erb
index 84bf178328954205c4ade68ca92f68eb4da71a10..787d31dda7f56bac603afd9af3056bb8dddbe454 100644 (file)
@@ -235,7 +235,9 @@ OSM.Routing=function(map,name,jqSearch) {
         else                { return Math.round(m / 1000)  + "km"; }
     };
     r.formatTime=function(s) {
-        var d=new Date(s*1000); var h=d.getHours(); var m=d.getMinutes();
+        var m=Math.round(s/60);
+        var h=Math.floor(m/60);
+        m -= h*60;
         return h+":"+(m<10 ? '0' : '')+m;
     };