mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -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 month = startOfMonth.toCalendar()[Calendar.MONTH] + 1
|
||||||
val year = startOfMonth.toCalendar()[Calendar.YEAR]
|
val year = startOfMonth.toCalendar()[Calendar.YEAR]
|
||||||
val weekday = startOfMonth.weekday
|
val weekday = startOfMonth.weekday
|
||||||
val extraWeekdays = YearMonth.of(year, month).lengthOfMonth() - 28
|
val monthLength = YearMonth.of(year, month).lengthOfMonth()
|
||||||
|
|
||||||
val freq = Array(7) { 4 }
|
val freq = Array(7) { 0 }
|
||||||
for (day in weekday until weekday + extraWeekdays) {
|
for (day in weekday until weekday + monthLength) {
|
||||||
freq[day % 7] = 5
|
freq[day % 7] += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
return freq
|
return freq
|
||||||
|
|||||||
Reference in New Issue
Block a user