fix(month): start new events on the selected day in Split view (#87)

The FAB anchored on today (or the 1st of a non-current month) in every
month style. Split keeps a selected day and lists it below the grid, so
that is the day a new event belongs to.
This commit is contained in:
2026-07-30 17:40:11 +02:00
parent 401e067945
commit c6360d248e
2 changed files with 13 additions and 3 deletions

View File

@@ -365,10 +365,16 @@ fun MonthScreen(
todayText = stringResource(R.string.month_today_action),
onToday = jumpToToday,
onCreate = {
// Anchor on today when its month is shown, else the 1st.
// Split has a selected day and lists it below the grid, so
// that is the day the new event belongs to. The other
// styles have no selection: anchor on today when its month
// is shown, else the 1st.
onCreateEvent(
if (isOnCurrentMonth) today
else LocalDate(titleMonth.year, titleMonth.month, 1),
when {
viewStyle == MonthViewStyle.Split -> selectedDate
isOnCurrentMonth -> today
else -> LocalDate(titleMonth.year, titleMonth.month, 1)
},
null,
)
},