From 6e0a155a4d83865a1538d958059d445c814ef7f4 Mon Sep 17 00:00:00 2001 From: Guilherme Lazzari Date: Tue, 21 Jan 2014 06:23:23 -0700 Subject: [PATCH] Upgrade bootstrap-datepicker.js to latest version Upgrade required to fix bug where date selection from previous and next year was wrong. Closes-Bug: 1270884 Change-Id: I7cb6f7f5fd0a709cbf0c1325e832c92ec382b12c --- horizon/static/bootstrap/js/bootstrap-datepicker.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/horizon/static/bootstrap/js/bootstrap-datepicker.js b/horizon/static/bootstrap/js/bootstrap-datepicker.js index 9ee95f310b..bf3a56df02 100644 --- a/horizon/static/bootstrap/js/bootstrap-datepicker.js +++ b/horizon/static/bootstrap/js/bootstrap-datepicker.js @@ -199,16 +199,20 @@ var nextMonth = new Date(prevMonth); nextMonth.setDate(nextMonth.getDate() + 42); nextMonth = nextMonth.valueOf(); - html = []; - var clsName; + var html = []; + var clsName, + prevY, + prevM; while(prevMonth.valueOf() < nextMonth) { if (prevMonth.getDay() === this.weekStart) { html.push(''); } clsName = this.onRender(prevMonth); - if (prevMonth.getMonth() < month) { + prevY = prevMonth.getFullYear(); + prevM = prevMonth.getMonth(); + if ((prevM < month && prevY === year) || prevY < year) { clsName += ' old'; - } else if (prevMonth.getMonth() > month) { + } else if ((prevM > month && prevY === year) || prevY > year) { clsName += ' new'; } if (prevMonth.valueOf() === currentDate) {