Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datepicker: Fixed #8420 - Datepicker: calculateWeek doesn't take firstDay setting into account #693

Closed
wants to merge 5 commits into from
12 changes: 10 additions & 2 deletions ui/jquery.ui.datepicker.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1562,8 +1562,16 @@ $.extend(Datepicker.prototype, {
var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
calender += '<tr>'; calender += '<tr>';
var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' + var tbody = '';
this._get(inst, 'calculateWeek')(printDate) + '</td>'); if (showWeek) { // if the displayed starts and ends in different iso8601 weeks, show both. #8420
var startWeek = this._get(inst, 'calculateWeek')(printDate);
var endDate = new Date(printDate);
endDate.setDate(endDate.getDate() + 6);
endDate = this._daylightSavingAdjust(endDate);
var endWeek = this._get(inst, 'calculateWeek')(endDate);
var weekText = (startWeek === endWeek) ? startWeek : startWeek + "/" + endWeek;
tbody = '<td class="ui-datepicker-week-col">' + weekText + '</td>';
}
for (var dow = 0; dow < 7; dow++) { // create date picker days for (var dow = 0; dow < 7; dow++) { // create date picker days
var daySettings = (beforeShowDay ? var daySettings = (beforeShowDay ?
beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
Expand Down