Update 24 hour times to have zeros in front of single digit numbers
Previously, the gr-date-formatter formatted 24 hour times as H:MM
so times less than 10am had a single digit before the colon. This
change updates the time format to HH:mm so that all single digit
numbers have a zero in front of them.
Bug: Issue 4656
Change-Id: Ic91f95987ac50528cfb4955809ac8d08e915308d
diff --git a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter.js b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter.js
index f380dd9..f6117e4 100644
--- a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter.js
+++ b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter.js
@@ -21,7 +21,7 @@
var TimeFormats = {
TIME_12: 'h:mm A', // 2:14 PM
- TIME_24: 'H:mm', // 14:14
+ TIME_24: 'HH:mm', // 14:14
MONTH_DAY: 'MMM DD', // Aug 29
MONTH_DAY_YEAR: 'MMM DD, YYYY', // Aug 29, 1997
};
diff --git a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.html b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.html
index d1886e7..8d65bc3 100644
--- a/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.html
+++ b/polygerrit-ui/app/elements/shared/gr-date-formatter/gr-date-formatter_test.html
@@ -98,13 +98,13 @@
test('More than 24 hours but less than six months', function(done) {
testDates('2015-07-29 20:34:14.985000000',
'2015-06-15 03:25:14.985000000',
- 'Jun 15', 'Jun 15, 2015, 3:25', done);
+ 'Jun 15', 'Jun 15, 2015, 03:25', done);
});
test('More than six months', function(done) {
testDates('2015-09-15 20:34:00.000000000',
'2015-01-15 03:25:00.000000000',
- 'Jan 15, 2015', 'Jan 15, 2015, 3:25', done);
+ 'Jan 15, 2015', 'Jan 15, 2015, 03:25', done);
});
});
@@ -174,7 +174,7 @@
});
test('Default preferences are respected', function() {
- assert.equal(element._timeFormat, 'H:mm');
+ assert.equal(element._timeFormat, 'HH:mm');
assert.isFalse(element._relative);
});
});