From 932c11f561d09ab6ff4e573ed48240a9ffe004bf Mon Sep 17 00:00:00 2001 From: James Holland Date: Fri, 4 Apr 2014 16:37:29 -0600 Subject: [PATCH] Fixed get week of year function. It was broken before with a Document write call and outputted a double instead of integer. --- date-functions.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/date-functions.js b/date-functions.js index 611ed08..1f8e0ea 100644 --- a/date-functions.js +++ b/date-functions.js @@ -310,8 +310,7 @@ Date.prototype.getWeekOfYear = function () { var now = this.getDayOfYear() + (4 - this.getDay()); var jan1 = new Date(this.getFullYear(), 0, 1); var then = (7 - jan1.getDay() + 4); - document.write(then); - return String.leftPad(((now - then) / 7) + 1, 2, "0") + return String.leftPad(Math.ceil((now - then) / 7) + 1, 2, "0") }; Date.prototype.isLeapYear = function () { var year = this.getFullYear();