[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [atlas/master] add years to first seen #23890



commit d660d2bdbcf35d1d1ed2158543897c79e04fb3ad
Author: Joren Vandeweyer <joren@Joren.local>
Date:   Fri Oct 20 22:46:22 2017 +0200

    add years to first seen #23890
---
 js/models/relay.js | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/js/models/relay.js b/js/models/relay.js
index 1e9f812..c90ffe0 100644
--- a/js/models/relay.js
+++ b/js/models/relay.js
@@ -69,13 +69,27 @@ define([
             var mins = Math.floor(secs/60);
             var hours = Math.floor(mins/60);
             var days = Math.floor(hours/24);
+            var years = Math.floor(days/365);
             // XXX check if this formula is correct.
             secs = secs % 60;
             mins = mins % 60;
             hours = hours % 24;
+            days = days % 365;
+
             var hr_date = "";
             var hr_date_full = "";
             var hr = 0;
+
+            if (years > 0) {
+                hr_date += years + "y ";
+                hr += 1;
+                if (years > 1) {
+                    hr_date_full += years + " years ";
+                } else {
+                    hr_date_full += years + " year ";
+                }
+            }
+
             if (days > 0) {
                 hr_date += days + "d ";
                 hr += 1;
@@ -216,4 +230,3 @@ define([
 
 	return relayModel;
 });
-



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits