Skip to content

Commit

Permalink
Merge pull request #86 from aryan-debug/master
Browse files Browse the repository at this point in the history
Fixed issue #84
  • Loading branch information
samsonjs committed May 24, 2023
2 parents 93aaf1e + b50d512 commit 67c02b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion strftime.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,8 @@
// '70'
// case 'y':
case 121:
resultString += ('' + date.getFullYear()).slice(2);
let year_without_century = ('' + date.getFullYear()).slice(2)
resultString += year_without_century.slice(padding === "" && year_without_century.charAt(0) === "0" ? 1 : 0);
break;

// '+0000'
Expand Down
4 changes: 3 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if (process.env.TZ == 'America/Vancouver') {
testTimezone('America/Vancouver');
assert.format('%C', '01', '01', new Date(100, 0, 1));
assert.format('%X', '11:51:45 AM', '06:51:45 PM');
assert.format('%c', 'Tue 07 Jun 2011 11:51:45 AM Pacific Daylight Time', 'Tue 07 Jun 2011 06:51:45 PM GMT');
assert.format('%c', 'Tue 07 Jun 2011 11:51:45 AM Pacific Daylight Saving Time', 'Tue 07 Jun 2011 06:51:45 PM GMT');
assert.format('%j', '097', '098', new Date(1365390736236));
assert.format('%x', '06/07/11');
assert.format('%U', '12', null, new Date('2017-03-25 00:00:00 +0000'));
Expand Down Expand Up @@ -100,6 +100,8 @@ 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("%-y", "23", null, new Date('2023-02-03T04:05:06'))
assert.format('%_l', null, ' 6');
assert.format('%0l', null, '06');
assert.format('%M', null, '51');
Expand Down

0 comments on commit 67c02b5

Please sign in to comment.