From 8b38727f0b224a9090d26cbec20e3fe23f196b3e Mon Sep 17 00:00:00 2001 From: Becky Siegel Date: Wed, 28 Sep 2016 15:18:40 -0700 Subject: [PATCH] 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 --- .../elements/shared/gr-date-formatter/gr-date-formatter.js | 2 +- .../shared/gr-date-formatter/gr-date-formatter_test.html | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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 f380dd9b26..f6117e4232 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 d1886e7de6..8d65bc30ce 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 @@ limitations under the License. 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 @@ limitations under the License. }); test('Default preferences are respected', function() { - assert.equal(element._timeFormat, 'H:mm'); + assert.equal(element._timeFormat, 'HH:mm'); assert.isFalse(element._relative); }); });