Skip to content

Commit 18a3c43

Browse files
authored
fix(ui5-datepicker): enable day selection in IE (#162)
1 parent 5df76e4 commit 18a3c43

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/main/src/DayPicker.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,17 @@ class DayPicker extends WebComponent {
253253
}
254254

255255
onclick(event) {
256-
if (event.ui5target.className.indexOf("sapWCDayPickerItem") > -1) {
257-
const targetDate = parseInt(event.ui5target.getAttribute("data-sap-timestamp"));
256+
const target = event.ui5target;
257+
const dayPressed = this._isDayPressed(target);
258+
259+
if (dayPressed) {
260+
const targetDate = parseInt(target.getAttribute("data-sap-timestamp"));
258261

259262
// findIndex, give it to item navigation
260263
for (let i = 0; i < this._weeks.length; i++) {
261264
for (let j = 0; j < this._weeks[i].length; j++) {
262265
if (parseInt(this._weeks[i][j].timestamp) === targetDate) {
263-
this._itemNav.current = parseInt(event.ui5target.getAttribute("data-sap-index"));
266+
this._itemNav.current = parseInt(target.getAttribute("data-sap-index"));
264267

265268
this._itemNav.update();
266269
break;
@@ -374,6 +377,11 @@ class DayPicker extends WebComponent {
374377
|| (iWeekendEnd < iWeekendStart && (iWeekDay >= iWeekendStart || iWeekDay <= iWeekendEnd));
375378
}
376379

380+
_isDayPressed(target) {
381+
const targetParent = target.parentNode;
382+
return (target.className.indexOf("sapWCDayPickerItem") > -1) || (targetParent && targetParent.className.indexOf("sapWCDayPickerItem") > -1);
383+
}
384+
377385
_getVisibleDays(oStartDate, bIncludeBCDates) {
378386
let oCalDate,
379387
iDaysOldMonth,

0 commit comments

Comments
 (0)