mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
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 gh-1943
This commit is contained in:
parent
70dae67b73
commit
cf938e2863
@ -1080,7 +1080,7 @@ $.extend( Datepicker.prototype, {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inst = this._getInst( target[ 0 ] );
|
inst = this._getInst( target[ 0 ] );
|
||||||
inst.selectedDay = inst.currentDay = $( "a", td ).html();
|
inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) );
|
||||||
inst.selectedMonth = inst.currentMonth = month;
|
inst.selectedMonth = inst.currentMonth = month;
|
||||||
inst.selectedYear = inst.currentYear = year;
|
inst.selectedYear = inst.currentYear = year;
|
||||||
this._selectDate( id, this._formatDate( inst,
|
this._selectDate( id, this._formatDate( inst,
|
||||||
@ -1932,6 +1932,7 @@ $.extend( Datepicker.prototype, {
|
|||||||
( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day
|
( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day
|
||||||
( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months
|
( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months
|
||||||
"' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader
|
"' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader
|
||||||
|
"' data-date='" + printDate.getDate() + // store date as data
|
||||||
"'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date
|
"'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date
|
||||||
printDate.setDate( printDate.getDate() + 1 );
|
printDate.setDate( printDate.getDate() + 1 );
|
||||||
printDate = this._daylightSavingAdjust( printDate );
|
printDate = this._daylightSavingAdjust( printDate );
|
||||||
|
Loading…
Reference in New Issue
Block a user