mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Fixes incorrect week calculation for monthly repeats
Using the built-in "week of month" value meant that any days before the 1st counted as “week 1,” so selecting the first Monday sometimes grabbed a date that actually belonged to a partial week from the previous month. The new approach replaces that by taking the numeric day (1-31) and grouping 1-7 as week 1, 8–14 as week 2, and so on - so "first Monday" really means the first Monday falling in days 1–7 of that month, not a stray day from a partial week.
This commit is contained in:
parent
94b69a9a7b
commit
2955c4e020
1 changed files with 4 additions and 1 deletions
|
|
@ -199,8 +199,11 @@ constructor(
|
|||
weeksOfMonth = null
|
||||
generateSummary()
|
||||
}
|
||||
|
||||
binding.monthlyRepeatWeeks.setOnClickListener {
|
||||
weeksOfMonth = mutableListOf(startDateCalendar.get(Calendar.WEEK_OF_MONTH) - 1)
|
||||
val dayOfMonth = startDateCalendar.get(Calendar.DAY_OF_MONTH)
|
||||
val zeroBasedWeekIdx = (dayOfMonth - 1) / 7
|
||||
weeksOfMonth = mutableListOf(zeroBasedWeekIdx)
|
||||
daysOfMonth = null
|
||||
generateSummary()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue