/** based on https://github.com/hustcc/timeago.js Copyright (c) 2016 hustcc License: MIT **/
lichess.timeago = (function() {

  // second, minute, hour, day, week, month, year(365 days)
  var SEC_ARRAY = [60, 60, 24, 7, 365/7/12, 12],
    SEC_ARRAY_LEN = 6;

  // format Date / string / timestamp to Date instance.
  function toDate(input) {
    return input instanceof Date ? input : (
      new Date(isNaN(input) ? input : parseInt(input))
    );
  }

  // format the diff second to *** time ago
  function formatDiff(diff) {
    var i = 0, agoin = diff < 0 ? 1 : 0, // timein or timeago
      total_sec = diff = Math.abs(diff);

    for (; diff >= SEC_ARRAY[i] && i < SEC_ARRAY_LEN; i++) {
      diff /= SEC_ARRAY[i];
    }
    diff = parseInt(diff);
    i *= 2;

    if (diff > (i === 0 ? 9 : 1)) i += 1;
    return lichess.timeagoLocale(diff, i, total_sec)[agoin].replace('%s', diff);
  }

  var formatterInst;

  function formatter() {
    return formatterInst = formatterInst || (window.Intl && Intl.DateTimeFormat ?
      new Intl.DateTimeFormat(document.documentElement.lang, {
        year: 'numeric',
        month: 'short',
        day: 'numeric',
        hour: 'numeric',
        minute: 'numeric'
      }).format : function(d) { return d.toLocaleString(); })
  }

   return {
     render: function(nodes) {
       var cl, abs, set, str, diff, now = Date.now();
       nodes.forEach(function(node) {
         cl = node.classList,
         abs = cl.contains('abs'),
         set = cl.contains('set');
         node.date = node.date || toDate(node.getAttribute('datetime'));
         if (!set) {
           str = formatter()(node.date);
           if (abs) node.textContent = str;
           else node.setAttribute('title', str);
           cl.add('set');
           if (abs || cl.contains('once')) cl.remove('timeago');
         }
         if (!abs) {
           diff = (now - node.date) / 1000;
           node.textContent = formatDiff(diff);
           if (Math.abs(diff) > 9999) cl.remove('timeago'); // ~3h
         }
       });
     },
     // relative
     format: function(date) {
       return formatDiff((Date.now() - toDate(date)) / 1000);
     },
     absolute: function(date) {
       return formatter()(toDate(date));
     }
   };
})();

@@ -205,56 +205,205 @@
 %5B60,
- 60, 24, 7, 365/7/12, 12%5D,%0A    SEC_ARRAY_LEN = 6
+%0A                   60 * 60,%0A                   60 * 60 * 24,%0A                   60 * 60 * 24 * 7, %0A                   60 * 60 * 2 * 7 * 365, // 24/12 = 2%0A                   60 * 60 * 24 * 7 * 365%5D
 ;%0A%0A 
@@ -697,155 +697,169 @@
 n = 
-diff %3C 0 ? 1 : 0, // timein or timeago%0A      total_sec = diff = Math.abs(diff);%0A%0A    for (; diff %3E= SEC_ARRAY%5Bi%5D && i %3C SEC_ARRAY_LEN; i++) %7B%0A     
+0;%0A    if (diff %3C 0) %7B%0A      agoin = 1;%0A      diff = -diff;%0A    %7D %0A    var i = 0, total_sec = diff;%0A    while (i %3C 6 && diff %3E= SEC_ARRAY%5Bi%5D) i++;%0A    if (i %3E 0)
  dif
@@ -878,16 +878,19 @@
 AY%5Bi
+ - 1
 %5D;%0A    
-%7D
 %0A   
@@ -897,24 +897,26 @@
  diff = 
-parseInt
+Math.floor
 (diff);%0A

Update timeago.js