hi-manshu / Kalendar

Kalendar is a powerful and customizable calendar library for Android applications. It provides a flexible and intuitive way to display and interact with calendars in your app. With Kalendar, you can easily render calendar views, handle date selection, pagination, and range selection, and customize the layout to match your app's design.

Home Page:https://www.himanshoe.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect Month Progression.

Onwa1kenobi opened this issue · comments

commented

image

I think I may be doing something wrong, because for some reason, when I am using the Endlos version of the calendar, I only get the remaining months of the current year, for all years. As you can see from the screenshot, after December, the next year begins from August.

Also, if the week does not have dates in the current month, there looks to be some kind of a padding/margin issue I haven't been able to fix. Any pointers would be appreciated.

I am working on this issue. I think the problem is with the KalendarPagingSource Class. In this class we filter the kalendar items.

Screenshot (1)

I think the kalendaritems are not filtered correctly. I am not sure though. I think it should be changed from:
val kalendarItems = kalendarRepository.generateDates(page) .filter { date -> date.year >= today.year && date.month.value >= today.monthNumber }
to
val kalendarItems = kalendarRepository.generateDates(page) .filter { date -> date.year >= today.year && date.month.value >= today.monthNumber }

What happens is that when we filter dates in the first example, we say that the year should be greater than or equal to the current year which is 2023. It means that only dates whose year is greater than or equal to 2023 are allowed. Thats fine but the problem here is that the months are also filtered according to the today's month. Thats why we say see august month after December as any dates before the month of august are not in the kalendaritems.

In the next example we solve this issue.

I have created a pull request too for this issue: Fixed InCorrect Month Progression Bug

commented

how did u make a dot on Day?

Just Use the KalendarEvents function inside the Kalendar

commented

can u show how to use it like for instance?

Sure, Here is an example how you can add events to your calendar

Kalendar(          currentDay = currentDay,          kalendarType = kalendarType,          modifier = modifier,          daySelectionMode = daySelectionMode,          showLabel = showLabel,          kalendarHeaderTextKonfig = kalendarHeaderTextKonfig,          kalendarColors = kalendarColors,          kalendarDayKonfig = kalendarDayKonfig,          onDayClick = onDayClick,          dayContent = dayContent,          headerContent = headerContent,          events = KalendarEvents(                  listOf(KalendarEvent(                         date = //date                          eventName  = "event"//add your event name                  )          ),          onRangeSelected = onRangeSelected,          onErrorRangeSelected = onErrorRangeSelected      ) }

commented

I dont know how to set dot in day each....

Could u share me ur code..? I want to refer to it