diff --git a/lib/dateformatter.js b/lib/dateformatter.js index f07e34d7..00c02134 100644 --- a/lib/dateformatter.js +++ b/lib/dateformatter.js @@ -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(); diff --git a/tests/filters.test.js b/tests/filters.test.js index 43f8a86b..de4b9a0b 100644 --- a/tests/filters.test.js +++ b/tests/filters.test.js @@ -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' },