Skip to content

Commit

Permalink
fix(ui5-datepicker): enable day selection in IE (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilhan007 committed Mar 12, 2019
1 parent 5df76e4 commit 18a3c43
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/main/src/DayPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,17 @@ class DayPicker extends WebComponent {
}

onclick(event) {
if (event.ui5target.className.indexOf("sapWCDayPickerItem") > -1) {
const targetDate = parseInt(event.ui5target.getAttribute("data-sap-timestamp"));
const target = event.ui5target;
const dayPressed = this._isDayPressed(target);

if (dayPressed) {
const targetDate = parseInt(target.getAttribute("data-sap-timestamp"));

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

this._itemNav.update();
break;
Expand Down Expand Up @@ -374,6 +377,11 @@ class DayPicker extends WebComponent {
|| (iWeekendEnd < iWeekendStart && (iWeekDay >= iWeekendStart || iWeekDay <= iWeekendEnd));
}

_isDayPressed(target) {
const targetParent = target.parentNode;
return (target.className.indexOf("sapWCDayPickerItem") > -1) || (targetParent && targetParent.className.indexOf("sapWCDayPickerItem") > -1);
}

_getVisibleDays(oStartDate, bIncludeBCDates) {
let oCalDate,
iDaysOldMonth,
Expand Down

0 comments on commit 18a3c43

Please sign in to comment.