From 5bbb08c0416fea2bf9e30b6ed4059eed8805ea9d Mon Sep 17 00:00:00 2001 From: Attila Seres Date: Wed, 3 Oct 2018 18:09:12 +0200 Subject: [PATCH 1/2] Fix date value in timestamp --- src/plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugin.js b/src/plugin.js index e95706e..99cd61f 100644 --- a/src/plugin.js +++ b/src/plugin.js @@ -30,7 +30,7 @@ export function delay(time = 100) { export function currentDate() { const date = new Date() const YYYY = pad(date.getFullYear()) - const MM = pad(date.getMonth(), 2, 0) + const MM = pad(date.getMonth() + 1, 2, 0) const DD = pad(date.getDate(), 2, 0) const HH = pad(date.getHours(), 2, 0) const mm = pad(date.getMinutes(), 2, 0) From ec3f6b0791a17f173eff9086785e8da4a9f350d1 Mon Sep 17 00:00:00 2001 From: Attila Seres Date: Thu, 4 Oct 2018 16:08:33 +0200 Subject: [PATCH 2/2] Fix testcase for timestamp --- test/test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index 4cd7689..681ab12 100644 --- a/test/test.js +++ b/test/test.js @@ -448,8 +448,9 @@ describe('Gulp plugin', () => { const valRgx = /^([0-9]{4})\.([0-9]{2})\.([0-9]{2})_([0-9]{2})\.([0-9]{2})\.([0-9]{2})$/ dateStr.should.match(valRgx) const match = valRgx.exec(dateStr) + const currentMonth = now.getMonth()+1 now.getFullYear().should.be.equal(Number(match[1])) - now.getMonth().should.be.equal(Number(match[2])) + currentMonth.should.be.equal(Number(match[2])) now.getDate().should.be.equal(Number(match[3])) now.getHours().should.be.equal(Number(match[4])) now.getMinutes().should.be.equal(Number(match[5]))