mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
change getWeekdaysInMonth method
This commit is contained in:
@@ -189,11 +189,11 @@ abstract class DateUtils {
|
||||
val month = startOfMonth.toCalendar()[Calendar.MONTH] + 1
|
||||
val year = startOfMonth.toCalendar()[Calendar.YEAR]
|
||||
val weekday = startOfMonth.weekday
|
||||
val extraWeekdays = YearMonth.of(year, month).lengthOfMonth() - 28
|
||||
val monthLength = YearMonth.of(year, month).lengthOfMonth()
|
||||
|
||||
val freq = Array(7) { 4 }
|
||||
for (day in weekday until weekday + extraWeekdays) {
|
||||
freq[day % 7] = 5
|
||||
val freq = Array(7) { 0 }
|
||||
for (day in weekday until weekday + monthLength) {
|
||||
freq[day % 7] += 1
|
||||
}
|
||||
|
||||
return freq
|
||||
|
||||
Reference in New Issue
Block a user