From 3bbe9b30d3f0797fb4cb53e075015a8d8c358f9b Mon Sep 17 00:00:00 2001 From: "dilan.dogan2" Date: Wed, 4 Dec 2024 16:12:21 +0300 Subject: [PATCH] feat(datepicker): review update --- src/components/calendar/bl-calendar.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/calendar/bl-calendar.ts b/src/components/calendar/bl-calendar.ts index fb1a0dea..330887e4 100644 --- a/src/components/calendar/bl-calendar.ts +++ b/src/components/calendar/bl-calendar.ts @@ -136,17 +136,17 @@ export default class BlCalendar extends DatepickerCalendarMixin { handleDate(date: Date) { if (this.type !== CALENDAR_TYPES.RANGE) { - const isDateBiggerThanCalendar = - (date.getMonth() < this._calendarMonth && date.getFullYear() > this._calendarYear) || - (date.getMonth() > this._calendarMonth && date.getFullYear() == this._calendarYear); + const isDateBeforeThanCalendar = + date.getFullYear() < this._calendarYear || + (date.getFullYear() === this._calendarYear && date.getMonth() < this._calendarMonth); - const isDateSmallerThanCalendar = - (date.getMonth() < this._calendarMonth && date.getFullYear() == this._calendarYear) || - (date.getMonth() > this._calendarMonth && date.getFullYear() < this._calendarYear); + const isDateAfterThanCalendar = + date.getFullYear() > this._calendarYear || + (date.getFullYear() === this._calendarYear && date.getMonth() > this._calendarMonth); - if (isDateSmallerThanCalendar) { + if (isDateBeforeThanCalendar) { this.setPreviousCalendarView(); - } else if (isDateBiggerThanCalendar) { + } else if (isDateAfterThanCalendar) { this.setNextCalendarView(); } }