Skip to content

Commit 978dd57

Browse files
committed
fix(calendar): check for range selection #4282
1 parent ca5ca54 commit 978dd57

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

projects/igniteui-angular/src/lib/calendar/days-view/day-item.component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ export class IgxDayItemComponent {
190190

191191
constructor(private elementRef: ElementRef) { }
192192

193-
194193
@HostListener('click')
195194
@HostListener('keydown.enter')
196195
public onSelect() {

projects/igniteui-angular/src/lib/calendar/days-view/days-view.component.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,11 @@ export class IgxDaysViewComponent extends IgxCalendarBase implements DoCheck {
209209
public isSelected(date: ICalendarDate): boolean {
210210
const selectedDates = (this.value as Date[]);
211211
if (!date.isCurrentMonth) {
212-
return;
212+
return false;
213213
}
214214

215215
if (!this.value || selectedDates.length === 0) {
216-
return;
216+
return false;
217217
}
218218

219219
if (selectedDates.length === 1) {
@@ -232,7 +232,7 @@ export class IgxDaysViewComponent extends IgxCalendarBase implements DoCheck {
232232
}
233233

234234
} else {
235-
return this.isWithinRange(date.date, false);
235+
return this.isWithinRange(date.date, true);
236236
}
237237
}
238238

@@ -281,7 +281,7 @@ export class IgxDaysViewComponent extends IgxCalendarBase implements DoCheck {
281281
*/
282282
public isWithinRange(date: Date, checkForRange: boolean, min?: Date, max?: Date): boolean {
283283
if (checkForRange && !(Array.isArray(this.value) && this.value.length > 1)) {
284-
return;
284+
return false;
285285
}
286286

287287
min = min ? min : this.value[0];
@@ -612,7 +612,7 @@ export class IgxDaysViewComponent extends IgxCalendarBase implements DoCheck {
612612
if (date.isCurrentMonth && !this.isSingleSelection && this.isWithinRange(date.date, true)) {
613613
const nextDay = new Date(date.date);
614614
nextDay.setDate(nextDay.getDate() + inc);
615-
if (this.isWithinRange(nextDay, false) && date.date.getMonth() + inc === nextDay.getMonth()) {
615+
if (this.isWithinRange(nextDay, true) && date.date.getMonth() + inc === nextDay.getMonth()) {
616616
return true;
617617
}
618618
}

0 commit comments

Comments
 (0)