* Called upon "Home" or "End" - moves the focus to the first or last item in the row. * @param homePressed * @private
(homePressed: boolean)
| 741 | * @private |
| 742 | */ |
| 743 | _onHomeOrEnd(homePressed: boolean) { |
| 744 | this._weeks.forEach(week => { |
| 745 | const _week = week as Array<Day>; |
| 746 | const dayInThisWeek = _week.findIndex(item => { |
| 747 | const date = CalendarDate.fromTimestamp(parseInt(item.timestamp) * 1000); |
| 748 | return date.getMonth() === this._calendarDate.getMonth() && date.getDate() === this._calendarDate.getDate(); |
| 749 | }) !== -1; |
| 750 | if (dayInThisWeek) { // The current day is in this week |
| 751 | const index = homePressed ? 1 : 7; // select the first (if Home) or last (if End) day of the week |
| 752 | this._setTimestamp(parseInt(_week[index].timestamp)); |
| 753 | } |
| 754 | }); |
| 755 | } |
| 756 | |
| 757 | /** |
| 758 | * Called by the Calendar component. |
no test coverage detected