bug #2506 Datepicker displays wrong week numbers

The datepicker displays wrong week numbers if the starting-day is 0 (Sunday),
because it uses the first day of the row to determine the weeknumber of the corresponding row.
According to ISO 8601 the week starts on Monday and ends on Sunday.
Consequently the datapicker will display e.g. for the week Sun Aug 17 - Sat Aug 23 the number of the week that ended on Sun Aug 17 and not the week that starts on Mon Aug 18.
Using the date at middle of the row will display the correct week number regardless of whether the week display starts with a Sunday or a Monday.
There's no need to change the while loop logic once the first week number (`weekNumber`) is determined correctly.