kizitonwose / Calendar

A highly customizable calendar view and compose library for Android.
MIT License
4.5k stars 492 forks source link

Changing `firstDayOfWeek` on `CalendarState` in Compose module doesn't refresh the current month #514

Closed benoitletondor closed 6 months ago

benoitletondor commented 6 months ago

Library information:

Describe the bug**

Calling calendarState.firstDayOfWeek = DayOfWeek.SUNDAY doesn't refresh the view correctly. Navigating to the previous or next month and moving back to the first one makes it work though, so it's really just a matter of redrawing the current month.

To Reproduce (if applicable)

Steps to reproduce the behavior:

  1. Use a first value for firstDayOfWeek, let's say MONDAY, using the HorizontalCalendar in Compose
  2. Change it after the calendar is displayed, using an effect, to something else
  3. Observe the calendar doesn't refresh

Expected behavior (if applicable)

I expect the calendar and its header/footer to be refreshed with the right value

kizitonwose commented 6 months ago

This is now fixed in the latest library snapshot. You can use the snapshot to check that it works as expected.

Snapshot url: maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' } Snapshot artifact: implementation 'com.kizitonwose.calendar:compose:2.5.1-SNAPSHOT'

benoitletondor commented 6 months ago

Thanks a lot @kizitonwose , I'll wait for the fix to land in stable but I'll make sure to take a look once it is! Many thanks once again

kizitonwose commented 6 months ago

Now released in 2.4.1