From 51a6ade03d1fc992fc51e559eb8435563b3585ae Mon Sep 17 00:00:00 2001 From: aryan-debug Date: Mon, 17 Apr 2023 01:54:01 -0700 Subject: [PATCH] Fixed issue #84 --- strftime.js | 2 +- test.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/strftime.js b/strftime.js index 84f5642..0dd38ca 100644 --- a/strftime.js +++ b/strftime.js @@ -649,7 +649,7 @@ // '70' // case 'y': case 121: - resultString += ('' + date.getFullYear()).slice(2); + resultString += ('' + date.getFullYear()).slice(padding === "" ? 3 : 2); break; // '+0000' diff --git a/test.js b/test.js index 16ae51e..981c5b9 100755 --- a/test.js +++ b/test.js @@ -100,6 +100,7 @@ assert.format('%k', null, '18'); assert.format('%L', '067'); assert.format('%l', null, ' 6'); assert.format('%-l', null, '6'); +assert.format("%-y", "1", null, new Date('2001-02-03T04:05:06')) assert.format('%_l', null, ' 6'); assert.format('%0l', null, '06'); assert.format('%M', null, '51');