Skip to content

Commit b50d512

Browse files
committedMay 22, 2023
Fixed issue #84
1 parent 6157e8a commit b50d512

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
 

‎strftime.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,8 @@
649649
// '70'
650650
// case 'y':
651651
case 121:
652-
resultString += ('' + date.getFullYear()).slice(padding === "" ? 3 : 2);
652+
let year_without_century = ('' + date.getFullYear()).slice(2)
653+
resultString += year_without_century.slice(padding === "" && year_without_century.charAt(0) === "0" ? 1 : 0);
653654
break;
654655

655656
// '+0000'

‎test.js

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ assert.format('%L', '067');
101101
assert.format('%l', null, ' 6');
102102
assert.format('%-l', null, '6');
103103
assert.format("%-y", "1", null, new Date('2001-02-03T04:05:06'))
104+
assert.format("%-y", "23", null, new Date('2023-02-03T04:05:06'))
104105
assert.format('%_l', null, ' 6');
105106
assert.format('%0l', null, '06');
106107
assert.format('%M', null, '51');

0 commit comments

Comments
 (0)
Please sign in to comment.