-
Notifications
You must be signed in to change notification settings - Fork 10
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
Day Of Week Offset Does Not Work Correctly #17
Comments
@WojciechOsak can you update this please? |
@richardortiz84 what else did you change? I updated those functions but now it's updated to val startDate = LocalDate.today()
val config = rememberCalendarState(
startDate = startDate,
monthOffset = 0,
dayOfWeekOffset = 6
)
CalendarView(
config = config,
) |
@ismai117 My apologies I forgot that I had also modified the Item composable in the calendar view. I have updated my original comment but here is the additional changes. In CalendarView.kt in function
Delete Line 152 in function
|
When attempting to set the dayOfWeekOffset to be Sunday like a typical work week calendar, I noticed that the start of the week would indeed be set to the given day, but the calendar then began 6 days in advance. For instance this month August 2024 setting the dayOfWeekOffset to Sunday resulted in a calendar having a first visible day of 7. If you turned on
showPreviousMonthDays
, the 3 days that show at the beginning of the calendar would be visually set to be the previous month, but would in fact be days from this month (4, 5, and 6).My assumption is that setting this field would set the beginning of the week to be the given day but the months calendar would still begin on the 1st.
This seems to be because
calculateVisibleDaysOfPreviousMonth
andcalculateVisibleDaysOfNextMonth
do not take into account the offset and adjust the numbers accordingly.Here is an update to those functions to account for the offset:
In CalendarView.kt in function
private fun CalendarView()
Update the function calls in lines 73-77
Delete Line 152 in function
private fun Item()
Here is the after:
The text was updated successfully, but these errors were encountered: