Browse files

update for date time

  • Loading branch information...
1 parent 762211a commit 627e6d14dc8f39835e1e67693f9912925e2a4d78 @vipworld vipworld committed Sep 12, 2012
Showing with 8 additions and 7 deletions.
  1. +5 −4 www/htime.ms
  2. +2 −2 www/views/_services.jade
  3. +1 −1 www/views/sensor.jade
View
9 www/htime.ms
@@ -30,8 +30,9 @@ export class HumanTime {
var ret = [];
foreach (var v:i in VALS) {
var amount = Math.floor(ms / v);
+ console.log(UNITS[i], ms / v, ms, v);
ms -= amount * v;
- if (amount > 0) ret.push(amount + UNITS[i]);
+ if (amount > 0 || i == 3) ret.push(amount + UNITS[i]);
}
return ret.join(' ');
@@ -41,9 +42,9 @@ export class HumanTime {
return (n < 10 ? "0" : '') + n;
}
- function dateTime(t) {
- if (typeof t != 'number') return '';
- var d = new Date(t);
+ function dateTime(d) {
+ // if (typeof t != 'number') return '';
+ // var d = new Date(t);
var date = [d.getMonth(), d.getDay(), d.getFullYear()].join('-');
var minute = this.pad(d.getMinutes());
var second = this.pad(d.getSeconds());
View
4 www/views/_services.jade
@@ -24,8 +24,8 @@ table.table.table-condensed.table-bordered
!= health(sensor.isHealthy)
span.inlinesparkline= sensor.getAvgResponse('hour').join(',');
td #{sensor.passCount}/#{sensor.totalCount}
- td= htime.timeDistance(sensor.lastPass) + ' ago';
- td= htime.timeDistance(sensor.lastFail) + ' ago';
+ td= htime.humanizeAgo(sensor.lastPass);
+ td= htime.humanizeAgo(sensor.lastFail);
:mochi
$(function() {
View
2 www/views/sensor.jade
@@ -21,7 +21,7 @@ block content
td= sensor.status
th Last Failure
td
- = sensor.lastFailure
+ = htime.dateTime(sensor.lastFailure);
if sensor.lastError
= " (" + sensor.lastError.toString() + ")";
tr

0 comments on commit 627e6d1

Please sign in to comment.