]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Fix idle time display.
authorChris Porter <redacted>
Sun, 19 Oct 2008 01:13:09 +0000 (02:13 +0100)
committerChris Porter <redacted>
Sun, 19 Oct 2008 01:13:09 +0000 (02:13 +0100)
js/irc/irclib.js
js/jslib.js

index 1bd3db08ad70cdef39c903651ef626e26df3723e..4f178b2d83aa3e927f407549158ffe90fa9574f4 100644 (file)
@@ -55,16 +55,12 @@ String.prototype.hostToHost = function() {
 }
 
 qwebirc.irc.IRCTimestamp = function(d) {
-  function pad(x) {
-    x = "" + x;
-    if(x.length == 1)
-      return "0" + x;
-    return x
-  }
-  
-  return "[" + pad(d.getHours()) + ":" + pad(d.getMinutes()) + "]";
+  return "[" + qwebirc.util.pad(d.getHours()) + ":" + qwebirc.util.pad(d.getMinutes()) + "]";
 }
 
 qwebirc.irc.IRCDate = function(d) {
+  var pad = qwebirc.util.pad;
+  
+  alert(qwebirc.util.DaysOfWeek[d.getDay()]);
   return qwebirc.util.DaysOfWeek[d.getDay()] + " " + qwebirc.util.MonthsOfYear[d.getMonth()] + " " + pad(d.getDate()) + " "  + pad(d.getHours()) + ":" + pad(d.getMinutes()) + ":" + pad(d.getSeconds()) + " " + d.getFullYear();
 }
index 72ce15cfb317842b11c5f4de6634f0276d2e6a15..dd828df1425c1c4474d907ebf05e26078a102cbe 100644 (file)
@@ -107,9 +107,16 @@ qwebirc.util.NBSPCreate = function(text, element) {
 
 qwebirc.util.longtoduration = function(l) {
   var seconds = l % 60;
-  var minutes = l / 60;
-  var hours = minutes / 60;
-  var days = hours / 24;
+  var minutes = Math.round(l / 60);
+  var hours = Math.round(minutes / 60);
+  var days = Math.round(hours / 24);
   
   return days + " days " + hours + " hours " + minutes + " minutes " + seconds + " seconds";
 }
+
+qwebirc.util.pad = function(x) {
+  x = "" + x;
+  if(x.length == 1)
+    return "0" + x;
+  return x
+}