From 660efa1d53507452a4862bea48738a88af5f353f Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Fri, 21 Sep 2012 12:58:14 +0530 Subject: [PATCH] Fix time formatting in tooltip --- js/server_status_monitor.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/server_status_monitor.js b/js/server_status_monitor.js index b2f9318603..1021ad69e9 100644 --- a/js/server_status_monitor.js +++ b/js/server_status_monitor.js @@ -1139,7 +1139,16 @@ $(function() { .fadeIn(); } var xVal = new Date(Math.ceil(neighbor.data[0])); - xVal = xVal.getHours() + ":" + xVal.getMinutes() + ":" + xVal.getSeconds(); + var xValHours = xVal.getHours(); + (xValHours < 10) ? (xValHours = "0" + xValHours) : ""; + + var xValMinutes = xVal.getMinutes(); + (xValMinutes < 10) ? (xValMinutes = "0" + xValMinutes) : ""; + + var xValSeconds = xVal.getSeconds(); + (xValSeconds < 10) ? (xValSeconds = "0" + xValSeconds) : ""; + + xVal = xValHours + ":" + xValMinutes + ":" + xValSeconds; var s = '' + xVal + '
' + neighbor.data[1] + '
'; $('#tooltip_box').html(s);