vendor/assets/javascripts/webshims/shims/forms-picker.js in webshims-rails-1.10.9 vs vendor/assets/javascripts/webshims/shims/forms-picker.js in webshims-rails-1.10.10

- old
+ new

@@ -278,14 +278,23 @@ this.setFocus(button.eq(0)); } }; }); + //taken from jquery ui picker.getWeek = function(date){ - var onejan = new Date(date.getFullYear(),0,1); - return Math.ceil((((date - onejan) / 86400000) + onejan.getDay()+1)/7); + var time; + var checkDate = new Date(date.getTime()); + + checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); + + time = checkDate.getTime(); + checkDate.setMonth(0); + checkDate.setDate(1); + return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; }; + picker.getYearList = function(value, data){ var j, i, val, disabled, lis, prevDisabled, nextDisabled, classStr, classArray, start; var size = data.options.size; @@ -530,9 +539,12 @@ if(addTr){ rowNum++; str.push('</tr><tr class="ws-row-'+ rowNum +'">'); if(data.options.showWeek) { week++; + if(week > 52){ + week = picker.getWeek(date); + } str.push('<td class="week-cell">'+ week +'</td>'); } } if(!i){