Skip to content

Commit cf938e2

Browse files
authored
Datepicker: Get selectedDay from data-date instead of element contents
This makes datepicker work fine even if translation software modifies texts on the page. Closes jquerygh-1943
1 parent 70dae67 commit cf938e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ui/widgets/datepicker.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ $.extend( Datepicker.prototype, {
10801080
}
10811081

10821082
inst = this._getInst( target[ 0 ] );
1083-
inst.selectedDay = inst.currentDay = $( "a", td ).html();
1083+
inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) );
10841084
inst.selectedMonth = inst.currentMonth = month;
10851085
inst.selectedYear = inst.currentYear = year;
10861086
this._selectDate( id, this._formatDate( inst,
@@ -1932,6 +1932,7 @@ $.extend( Datepicker.prototype, {
19321932
( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day
19331933
( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months
19341934
"' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader
1935+
"' data-date='" + printDate.getDate() + // store date as data
19351936
"'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date
19361937
printDate.setDate( printDate.getDate() + 1 );
19371938
printDate = this._daylightSavingAdjust( printDate );

0 commit comments

Comments
 (0)