Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Commit

Permalink
Merge pull request #375 from cyberwombat/master
Browse files Browse the repository at this point in the history
Fix date formatting for 'N' (ISO-8601 numeric representation of the day of the week)
  • Loading branch information
paularmstrong committed Jan 10, 2014
2 parents d29067a + 2de7bd6 commit d70b853
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/dateformatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ exports.l = function (input) {
};
exports.N = function (input) {
var d = input.getDay();
return (d >= 1) ? d + 1 : 7;
return (d >= 1) ? d : 7;
};
exports.S = function (input) {
var d = input.getDate();
Expand Down
3 changes: 2 additions & 1 deletion tests/filters.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ var n = new Swig(),
{ c: 'v|date("D")', v: d, e: 'Tue' },
{ c: 'v|date("j")', v: d, e: '6' },
{ c: 'v|date("l")', v: d, e: 'Tuesday' },
{ c: 'v|date("N")', v: d, e: '3' },
{ c: 'v|date("N")', v: d, e: '2' },
{ c: 'v|date("N")', v: makeDate(420, 2011, 8, 4), e: '7'},
{ c: 'v|date("S")', v: d, e: 'th' },
{ c: 'v|date("w")', v: d, e: '2' },
{ c: 'v|date("z")', v: d, e: '248' },
Expand Down

0 comments on commit d70b853

Please sign in to comment.