]> git.openstreetmap.org Git - rails.git/commitdiff
Fix hours:minutes duration display for routing
authorDan Stowell <danstowell@users.sourceforge.net>
Sat, 22 Mar 2014 12:53:08 +0000 (12:53 +0000)
committerDan Stowell <danstowell@users.sourceforge.net>
Sat, 22 Mar 2014 12:53:08 +0000 (12:53 +0000)
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;
     };