// ==UserScript==
// @name           UTC to local time converter
// @namespace      https://github.com/aawc/UserScripts/raw/master/chromium-utc-to-local-time.js
// @description    Make times on codereview.chromium.org local to make them easier to read.
// @match          https://codereview.chromium.org/*
// @version        0.1
// ==/UserScript==

// Inspired by a private gist from danbeam@

(function(document) {
    var y = ', ' + new Date().getFullYear();
    var j = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
    var m = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
    var re = /(.*)\((.* UTC)\)(.*)/;

    [].forEach.call(document.querySelectorAll(
        '#messages tr.comment_title td:nth-of-type(3)'), function (el, i) {
        if (i === 0) {
            el.width = 160;
        } else {
            var found = el.innerHTML.replace(/[\r\n]+/g," ").match(re);
            if (found && found[2]) {
                var d = new Date(found[2]);
                el.innerHTML = found[1] + '(' +
                    j[d.getDay()] + ' ' + m[d.getMonth()] + ' ' +
                    (d.getDate() < 10 ? '0' : '') + d.getDate() + ', ' +
                    (d.getHours() > 12 ? (d.getHours() - 12 === 0 ? '12' : d.getHours() - 12) :
                     (d.getHours() === 0 ? '12' : d.getHours())) + ':' +
                    (d.getMinutes() < 10 ? '0' : '') + d.getMinutes() + ' ' +
                    (d.getHours() > 12 ? 'p' : 'a') + 'm)' + found[3];
            }
        }
    });
}(unsafeWindow.document));

@@ -320,17 +320,17 @@
       0.
-1
+2
 %0A// ==/U
@@ -387,16 +387,81 @@
 nbeam@%0A%0A
+function toDoubleDigit(n) %7B%0A  return (n %3C 10 ? '0' : '') + n;%0A%7D%0A%0A
 (functio
@@ -470,24 +470,42 @@
 document) %7B%0A
+    'use strict';%0A
     var y = 
@@ -1127,36 +1127,16 @@
  + '(' +
-%0A                   
  j%5Bd.get
@@ -1153,32 +1153,8 @@
  ' +
- m%5Bd.getMonth()%5D + ' ' +
 %0A   
@@ -1174,40 +1174,46 @@
     
-(
+m%5B
 d.get
-Date() %3C 10 ? '0' : '') + 
+Month()%5D + ' ' + toDoubleDigit(
 d.ge
@@ -1219,16 +1219,17 @@
 etDate()
+)
  + ', ' 
@@ -1242,33 +1242,32 @@
                 
-(
 d.getHours() %3E 1
@@ -1267,198 +1267,30 @@
 s() 
-%3E 12 ? (d.getHours() - 12 === 0 ? '12' : d.getHours() - 12) :%0A                     (d.getHours() === 0 ? '12' : d.getHours())) + ':' +%0A                    (d.getMinutes() %3C 10 ? '0' : '') + 
++ ':' + toDoubleDigit(
 d.ge
@@ -1299,21 +1299,22 @@
 inutes()
+)
  + '
- 
+)
 ' +%0A    
@@ -1332,49 +1332,8 @@
     
- (d.getHours() %3E 12 ? 'p' : 'a') + 'm)' +
  fou

Simplify code by using 24-hour timestamps