From 161a476980e09f454bef898332f3ee2f2072caba Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Mon, 27 Jan 2014 23:45:09 -0800 Subject: [PATCH] fixed regression where weekNumberCalculation as a function wouldn't work --- src/Calendar.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Calendar.js b/src/Calendar.js index b7f77e2..b9a7dac 100644 --- a/src/Calendar.js +++ b/src/Calendar.js @@ -146,15 +146,16 @@ function Calendar(element, instanceOptions) { // `weekNumberCalculation` setting. t.calculateWeekNumber = function(mom) { var calc = options.weekNumberCalculation; - if (calc == 'local') { + + if (typeof calc === 'function') { + return calc(mom); + } + else if (calc === 'local') { return mom.week(); } - else if (calc.toUpperCase() == 'ISO') { + else if (calc.toUpperCase() === 'ISO') { return mom.isoWeek(); } - else if (typeof calc === 'function') { - return calc(mom); - } };