Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Month Progression. #157

Open
Onwa1kenobi opened this issue Aug 17, 2023 · 6 comments
Open

Incorrect Month Progression. #157

Onwa1kenobi opened this issue Aug 17, 2023 · 6 comments

Comments

@Onwa1kenobi
Copy link

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.

@AndroidJunior9
Copy link
Contributor

AndroidJunior9 commented Aug 19, 2023

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

@ParkJongJoon7128
Copy link

how did u make a dot on Day?

@AndroidJunior9
Copy link
Contributor

Just Use the KalendarEvents function inside the Kalendar

@ParkJongJoon7128
Copy link

can u show how to use it like for instance?

@AndroidJunior9
Copy link
Contributor

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      ) }

@ParkJongJoon7128
Copy link

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants