From 9350b0ad355363dfd9b4785272e567626a9cb0dd Mon Sep 17 00:00:00 2001 From: SchizoDuckie Date: Sat, 22 Feb 2014 01:30:35 +0100 Subject: [PATCH] Fixed january breaking with previous patch due to date being shifted back 5 days Fixes the situation where date.getMonth() turns into 11, thus breaking the patch. --- app/scripts/datePicker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/scripts/datePicker.js b/app/scripts/datePicker.js index 0cd7035..3a50106 100644 --- a/app/scripts/datePicker.js +++ b/app/scripts/datePicker.js @@ -23,7 +23,7 @@ function getVisibleMinutes(date, step) { function getVisibleWeeks(date) { date = new Date(date || new Date()); - var startMonth = date.getMonth(); + var startMonth = date.getMonth(), startYear = date.getYear(); date.setDate(1); date.setHours(0); date.setMinutes(0); @@ -41,7 +41,7 @@ function getVisibleWeeks(date) { var weeks = []; while (weeks.length < 6) { - if(date.getMonth() > startMonth) break; + if(date.getYear()== startYear && date.getMonth() > startMonth) break; var week = []; for (var i = 0; i < 7; i++) { week.push(new Date(date));