From 0ea734d53bf16867ee15f914cf604a86c202e79b Mon Sep 17 00:00:00 2001 From: Mike Henderyckx Date: Sun, 22 Sep 2019 14:35:32 +0200 Subject: [PATCH 1/7] Add leading zero to hour & minute on getCurrentTime() & use substr(-2) to cut it off when not needed --- src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index 2b579e54..dfee8e73 100644 --- a/src/utils.js +++ b/src/utils.js @@ -44,7 +44,7 @@ exports.getCurrentTime = function () { const year = time.getFullYear(); const month = MONTHS[time.getMonth()]; const day = time.getDate(); - const hour = time.getHours(); - const minute = time.getMinutes(); + const hour = `0${time.getHours()}`.substr(-2); + const minute = `0${time.getMinutes()}`.substr(-2); return `${day} ${month} ${year} at ${hour}:${minute}`; }; From 49623c95477c53cf32f876c08211708cdb62d49e Mon Sep 17 00:00:00 2001 From: Mike Henderyckx Date: Sun, 22 Sep 2019 14:58:19 +0200 Subject: [PATCH 2/7] Use .slice() in favor of soon to be deprecated .slice() --- src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index dfee8e73..f75cddbe 100644 --- a/src/utils.js +++ b/src/utils.js @@ -44,7 +44,7 @@ exports.getCurrentTime = function () { const year = time.getFullYear(); const month = MONTHS[time.getMonth()]; const day = time.getDate(); - const hour = `0${time.getHours()}`.substr(-2); - const minute = `0${time.getMinutes()}`.substr(-2); + const hour = `0${time.getHours()}`.slice(-2); + const minute = `0${time.getMinutes()}`.slice(-2); return `${day} ${month} ${year} at ${hour}:${minute}`; }; From 27b2de0d4a4334ccfdc2a44424984c563f39d06d Mon Sep 17 00:00:00 2001 From: Mike Henderyckx Date: Sun, 22 Sep 2019 14:58:19 +0200 Subject: [PATCH 3/7] Use .slice() in favor of soon to be deprecated .substr() --- src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index dfee8e73..f75cddbe 100644 --- a/src/utils.js +++ b/src/utils.js @@ -44,7 +44,7 @@ exports.getCurrentTime = function () { const year = time.getFullYear(); const month = MONTHS[time.getMonth()]; const day = time.getDate(); - const hour = `0${time.getHours()}`.substr(-2); - const minute = `0${time.getMinutes()}`.substr(-2); + const hour = `0${time.getHours()}`.slice(-2); + const minute = `0${time.getMinutes()}`.slice(-2); return `${day} ${month} ${year} at ${hour}:${minute}`; }; From f04ab3e15df5823bc1dcbdde69d9d9e5a0ff8518 Mon Sep 17 00:00:00 2001 From: Mike Henderyckx Date: Sun, 22 Sep 2019 20:44:36 +0200 Subject: [PATCH 4/7] Use .padStart(2,0) to prefix one-digit numbers with zero --- src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index f75cddbe..7f70c0c3 100644 --- a/src/utils.js +++ b/src/utils.js @@ -44,7 +44,7 @@ exports.getCurrentTime = function () { const year = time.getFullYear(); const month = MONTHS[time.getMonth()]; const day = time.getDate(); - const hour = `0${time.getHours()}`.slice(-2); - const minute = `0${time.getMinutes()}`.slice(-2); + const hour = `${time.getHours()}`.padStart(2,0); + const minute = `${time.getMinutes()}`.padStart(2,0); return `${day} ${month} ${year} at ${hour}:${minute}`; }; From 4b58faeb638a2694ec717edb24db1f287452bba2 Mon Sep 17 00:00:00 2001 From: Mike Henderyckx Date: Thu, 17 Oct 2019 12:25:26 +0200 Subject: [PATCH 5/7] Revert .padStart to .slice since padStart is not supported in Node v6 --- src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index 7f70c0c3..f75cddbe 100644 --- a/src/utils.js +++ b/src/utils.js @@ -44,7 +44,7 @@ exports.getCurrentTime = function () { const year = time.getFullYear(); const month = MONTHS[time.getMonth()]; const day = time.getDate(); - const hour = `${time.getHours()}`.padStart(2,0); - const minute = `${time.getMinutes()}`.padStart(2,0); + const hour = `0${time.getHours()}`.slice(-2); + const minute = `0${time.getMinutes()}`.slice(-2); return `${day} ${month} ${year} at ${hour}:${minute}`; }; From f614bd1c67d78c7193352a09dbb278647169cd07 Mon Sep 17 00:00:00 2001 From: Vesa Laakso <482561+valscion@users.noreply.github.com> Date: Thu, 17 Oct 2019 16:26:21 +0300 Subject: [PATCH 6/7] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebdb5e87..9f4ce13d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ _Note: Gaps between patch versions are faulty, broken or test releases._ + * **Bug Fix** + * Add leading zero to hour & minute on `` when needed ([#314](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/314) by [@mhxbe](https://github.com/mhxbe)) + ## 3.5.1 * **Bug Fix** From 25967834bae40afbd8c4d49cb56fe4b797c1620d Mon Sep 17 00:00:00 2001 From: Vesa Laakso <482561+valscion@users.noreply.github.com> Date: Thu, 17 Oct 2019 16:28:12 +0300 Subject: [PATCH 7/7] Consolidate changelog whitespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit My merge conflict resolve had a hickup 😅 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03c47924..d3d32df6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ _Note: Gaps between patch versions are faulty, broken or test releases._ <!-- Add changelog entries for new changes under this section --> -* **Bug Fix** + * **Bug Fix** * Add leading zero to hour & minute on `<title />` when needed ([#314](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/314) by [@mhxbe](https://github.com/mhxbe)) ## 3.6.0