From 70a20b07dc760c85cf304fb6e468d551794b091f Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Mon, 30 Nov 2026 19:22:45 +0100 Subject: [PATCH] Week numbering setting: Automatic, ISO, US (#493) --- .../jeanlucmakiola/calendula/MainActivity.kt | 2 + .../data/backup/SettingsBackupSchema.kt | 1 + .../calendula/data/prefs/SettingsPrefs.kt | 21 ++++- .../calendula/ui/common/WeekNumber.kt | 29 ++++-- .../calendula/ui/month/MonthScreen.kt | 4 +- .../calendula/ui/settings/SettingsUiState.kt | 3 + .../ui/settings/SettingsViewModel.kt | 4 + .../calendula/ui/settings/ViewsSettings.kt | 40 +++++++++ app/src/main/res/values/strings.xml | 7 ++ .../calendula/ui/common/WeekNumberTest.kt | 89 +++++++++++++++++++ 10 files changed, 190 insertions(+), 10 deletions(-) create mode 100644 app/src/test/java/de/jeanlucmakiola/calendula/ui/common/WeekNumberTest.kt diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/MainActivity.kt b/app/src/main/java/de/jeanlucmakiola/calendula/MainActivity.kt index 346d4755..941dd68d 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/MainActivity.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/MainActivity.kt @@ -49,6 +49,7 @@ import de.jeanlucmakiola.calendula.ui.common.LocalTimelineZoom import de.jeanlucmakiola.calendula.ui.common.rememberTimelineZoom import de.jeanlucmakiola.calendula.ui.common.LocalSoftenColors import de.jeanlucmakiola.calendula.ui.common.LocalUse24HourFormat +import de.jeanlucmakiola.calendula.ui.common.LocalWeekNumbering import de.jeanlucmakiola.calendula.ui.WidgetNavRequest import de.jeanlucmakiola.calendula.ui.common.CalendarView import de.jeanlucmakiola.calendula.ui.detail.EventDetailViewModel.Companion.NO_OCCURRENCE_TIME @@ -248,6 +249,7 @@ class MainActivity : AppCompatActivity() { LocalTimelineZoom provides timelineZoom, LocalMultiDayCount provides settings.multiDayCount, LocalSoftenColors provides settings.softenColors, + LocalWeekNumbering provides settings.weekNumbering, ) { RootScreen( modifier = Modifier.fillMaxSize(), diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/data/backup/SettingsBackupSchema.kt b/app/src/main/java/de/jeanlucmakiola/calendula/data/backup/SettingsBackupSchema.kt index f4d7bf3d..bf0f5140 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/data/backup/SettingsBackupSchema.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/data/backup/SettingsBackupSchema.kt @@ -28,6 +28,7 @@ internal object SettingsBackupSchema { SettingsKeys.pastEventDisplay, SettingsKeys.dimCompletedEvents, SettingsKeys.showWeekNumbers, + SettingsKeys.weekNumbering, SettingsKeys.monthShowStartTimes, SettingsKeys.monthViewStyle, SettingsKeys.timelineScale, diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/data/prefs/SettingsPrefs.kt b/app/src/main/java/de/jeanlucmakiola/calendula/data/prefs/SettingsPrefs.kt index 719405ea..b13206c5 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/data/prefs/SettingsPrefs.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/data/prefs/SettingsPrefs.kt @@ -90,6 +90,20 @@ sealed interface WeekStartPref { */ enum class TimeFormatPref { AUTO, TWELVE_HOUR, TWENTY_FOUR_HOUR } +/** + * How week numbers are counted (#493). AUTO follows the device region; ISO and + * US pin ISO 8601 or the US system. Only the number: rows still start on the + * day [WeekStartPref] picks. + */ +enum class WeekNumberingPref { AUTO, ISO, US } + +/** The [WeekFields] that count weeks under this preference; AUTO reads [region]. */ +fun WeekNumberingPref.weekFields(region: Locale): WeekFields = when (this) { + WeekNumberingPref.AUTO -> WeekFields.of(region) + WeekNumberingPref.ISO -> WeekFields.ISO + WeekNumberingPref.US -> WeekFields.SUNDAY_START +} + /** * How the Agenda screen treats events that have already finished today: [SHOW] * leaves them as-is (the historical behaviour), [DIM] fades them, [HIDE] drops @@ -171,6 +185,7 @@ class SettingsPrefs @Inject constructor( val pastEventDisplay: Flow = prefs.flow(SettingsKeys.pastEventDisplay) val dimCompletedEvents: Flow = prefs.flow(SettingsKeys.dimCompletedEvents) val showWeekNumbers: Flow = prefs.flow(SettingsKeys.showWeekNumbers) + val weekNumbering: Flow = prefs.flow(SettingsKeys.weekNumbering) val monthShowStartTimes: Flow = prefs.flow(SettingsKeys.monthShowStartTimes) val monthViewStyle: Flow = prefs.flow(SettingsKeys.monthViewStyle) val timelineScale: Flow = prefs.flow(SettingsKeys.timelineScale) @@ -269,6 +284,7 @@ class SettingsPrefs @Inject constructor( suspend fun setPastEventDisplay(mode: PastEventDisplay) = prefs.set(SettingsKeys.pastEventDisplay, mode) suspend fun setDimCompletedEvents(enabled: Boolean) = prefs.set(SettingsKeys.dimCompletedEvents, enabled) suspend fun setShowWeekNumbers(enabled: Boolean) = prefs.set(SettingsKeys.showWeekNumbers, enabled) + suspend fun setWeekNumbering(pref: WeekNumberingPref) = prefs.set(SettingsKeys.weekNumbering, pref) suspend fun setMonthShowStartTimes(enabled: Boolean) = prefs.set(SettingsKeys.monthShowStartTimes, enabled) suspend fun setMonthViewStyle(style: MonthViewStyle) = prefs.set(SettingsKeys.monthViewStyle, style) suspend fun setTimelineScale(scale: TimelineScale) = prefs.set(SettingsKeys.timelineScale, scale) @@ -708,11 +724,14 @@ object SettingsKeys { val dimCompletedEvents: Pref = booleanPref("dim_completed_events", false) /** - * Whether the Month grid shows the ISO week number in a left gutter (#25). + * Whether the Month grid shows the week number in a left gutter (#25). * The Week view shows its number unconditionally. */ val showWeekNumbers: Pref = booleanPref("show_week_numbers", false) + /** How every week number in the app is counted (#493). */ + val weekNumbering: Pref = enumPref("week_numbering", WeekNumberingPref.AUTO) + /** Whether Month chips may show the start time before the title when wide enough (#219, #476). */ val monthShowStartTimes: Pref = booleanPref("month_show_start_times", true) diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/common/WeekNumber.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/common/WeekNumber.kt index 6b34b62c..4500dfac 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/common/WeekNumber.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/common/WeekNumber.kt @@ -3,19 +3,34 @@ package de.jeanlucmakiola.calendula.ui.common import android.content.res.Resources import androidx.compose.runtime.Composable import androidx.compose.runtime.remember +import androidx.compose.runtime.staticCompositionLocalOf +import de.jeanlucmakiola.calendula.data.prefs.WeekNumberingPref +import de.jeanlucmakiola.calendula.data.prefs.weekFields import de.jeanlucmakiola.floret.time.rowWeekNumber import kotlinx.datetime.LocalDate import kotlinx.datetime.toJavaLocalDate -import java.time.temporal.WeekFields +import java.util.Locale + +/** The week-numbering setting (#493), provided once at the app root. */ +val LocalWeekNumbering = staticCompositionLocalOf { WeekNumberingPref.AUTO } /** - * The week number of the grid row starting on [rowStart], numbered by the - * device region's rules (#493). The region, not the app language: an English - * UI in the Netherlands still numbers weeks the ISO way. Shared by the Month - * gutter and the Week badge so the two always agree. + * The week number of the 7-day row starting on [rowStart], counted by + * [numbering] (AUTO reads [region]). The row takes the week holding most of its + * days: that of its mid-week day in the numbering system (Thursday for ISO, + * Wednesday for US), so any "Week starts on" choice gets a consistent number. + */ +fun rowWeekNumber(rowStart: LocalDate, numbering: WeekNumberingPref, region: Locale): Int = + rowStart.toJavaLocalDate().rowWeekNumber(numbering.weekFields(region)) + +/** + * [rowWeekNumber] for the composition's numbering setting. AUTO follows the + * device region, not the app language: an English UI in the Netherlands still + * numbers weeks the ISO way. Shared by the Month gutter and the Week badge. */ @Composable internal fun rememberRowWeekNumber(rowStart: LocalDate): Int { - val fields = remember { WeekFields.of(Resources.getSystem().configuration.locales[0]) } - return remember(rowStart, fields) { rowStart.toJavaLocalDate().rowWeekNumber(fields) } + val numbering = LocalWeekNumbering.current + val region = remember { Resources.getSystem().configuration.locales[0] } + return remember(rowStart, numbering, region) { rowWeekNumber(rowStart, numbering, region) } } diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/month/MonthScreen.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/month/MonthScreen.kt index 7a78eb26..1c8747db 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/month/MonthScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/month/MonthScreen.kt @@ -2757,8 +2757,8 @@ private fun monthChipDragModifier( * Left-gutter calendar-week cell (#25): a full-height tonal pill mirroring the * day cells' geometry, set apart by the secondaryContainer tint (matching the * Week view's badge), with the week number centred like a day number. It is - * numbered by the device region from the row's mid-week day, as in the Week - * view, so it is right for any first weekday (#493). + * numbered by the week-numbering setting from the row's mid-week day, as in the + * Week view, so it is right for any first weekday (#493). */ @Composable private fun WeekNumberGutter(weekStart: LocalDate, modifier: Modifier = Modifier) { diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/SettingsUiState.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/SettingsUiState.kt index a296674f..08fa2f36 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/SettingsUiState.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/SettingsUiState.kt @@ -9,6 +9,7 @@ import de.jeanlucmakiola.calendula.data.prefs.PastEventDisplay import de.jeanlucmakiola.calendula.data.prefs.SettingsPrefs import de.jeanlucmakiola.floret.prefs.ThemeMode import de.jeanlucmakiola.calendula.data.prefs.TimeFormatPref +import de.jeanlucmakiola.calendula.data.prefs.WeekNumberingPref import de.jeanlucmakiola.calendula.data.prefs.WeekStartPref import de.jeanlucmakiola.calendula.domain.CalendarSource import de.jeanlucmakiola.calendula.domain.EventFormField @@ -46,6 +47,8 @@ data class SettingsUiState( val dimCompletedEvents: Boolean = false, /** Whether the Month grid shows calendar-week numbers in a left gutter (#25). */ val showWeekNumbers: Boolean = false, + /** How week numbers are counted in every view (#493). */ + val weekNumbering: WeekNumberingPref = WeekNumberingPref.AUTO, /** Whether Month chips may show start times before their titles (#476). */ val monthShowStartTimes: Boolean = true, /** Whether the jump-to-today control sits in the top bar instead of the FAB (#60). */ diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/SettingsViewModel.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/SettingsViewModel.kt index 49915cc5..62551649 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/SettingsViewModel.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/SettingsViewModel.kt @@ -42,6 +42,7 @@ import de.jeanlucmakiola.floret.prefs.get import de.jeanlucmakiola.calendula.data.prefs.SpecialDatesStalledReason import de.jeanlucmakiola.floret.prefs.ThemeMode import de.jeanlucmakiola.calendula.data.prefs.TimeFormatPref +import de.jeanlucmakiola.calendula.data.prefs.WeekNumberingPref import de.jeanlucmakiola.calendula.data.prefs.WeekStartPref import de.jeanlucmakiola.calendula.data.reminders.ReminderChannelStatus import de.jeanlucmakiola.calendula.data.reminders.ReminderChannels @@ -142,6 +143,7 @@ class SettingsViewModel @Inject constructor( pastEventDisplay = this[SettingsKeys.pastEventDisplay], dimCompletedEvents = this[SettingsKeys.dimCompletedEvents], showWeekNumbers = this[SettingsKeys.showWeekNumbers], + weekNumbering = this[SettingsKeys.weekNumbering], monthShowStartTimes = this[SettingsKeys.monthShowStartTimes], todayButtonInToolbar = this[SettingsKeys.todayButtonInToolbar], dragToReschedule = this[SettingsKeys.dragToReschedule], @@ -345,6 +347,8 @@ class SettingsViewModel @Inject constructor( fun setShowWeekNumbers(enabled: Boolean) = save { setShowWeekNumbers(enabled) } + fun setWeekNumbering(pref: WeekNumberingPref) = save { setWeekNumbering(pref) } + fun setMonthShowStartTimes(enabled: Boolean) = save { setMonthShowStartTimes(enabled) } fun setTodayButtonInToolbar(enabled: Boolean) = save { setTodayButtonInToolbar(enabled) } diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/ViewsSettings.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/ViewsSettings.kt index 772b21aa..cd4974d5 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/ViewsSettings.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/settings/ViewsSettings.kt @@ -1,5 +1,6 @@ package de.jeanlucmakiola.calendula.ui.settings +import android.content.res.Resources import android.text.format.DateFormat import androidx.annotation.StringRes import androidx.compose.foundation.layout.Box @@ -28,7 +29,9 @@ import de.jeanlucmakiola.calendula.R import de.jeanlucmakiola.calendula.data.prefs.PastEventDisplay import de.jeanlucmakiola.calendula.data.prefs.SettingsPrefs import de.jeanlucmakiola.calendula.data.prefs.TimeFormatPref +import de.jeanlucmakiola.calendula.data.prefs.WeekNumberingPref import de.jeanlucmakiola.calendula.data.prefs.WeekStartPref +import de.jeanlucmakiola.calendula.data.time.currentDate import de.jeanlucmakiola.calendula.data.prefs.resolveFirstDay import de.jeanlucmakiola.calendula.ui.common.AgendaRangePicker import de.jeanlucmakiola.calendula.ui.common.CalendarView @@ -43,6 +46,8 @@ import de.jeanlucmakiola.calendula.ui.common.formatTimeOfDay import de.jeanlucmakiola.calendula.ui.common.icon import de.jeanlucmakiola.calendula.ui.common.label import de.jeanlucmakiola.calendula.ui.common.labelRes +import de.jeanlucmakiola.calendula.ui.common.rowWeekNumber +import de.jeanlucmakiola.calendula.ui.common.startOfWeek import de.jeanlucmakiola.calendula.ui.month.labelRes import de.jeanlucmakiola.floret.components.CollapsingScaffold import de.jeanlucmakiola.floret.components.GroupedHint @@ -77,6 +82,7 @@ internal fun ViewsScreen( var showMonthStyle by remember { mutableStateOf(false) } var showDefaultView by remember { mutableStateOf(false) } var showWeekStart by remember { mutableStateOf(false) } + var showWeekNumbering by remember { mutableStateOf(false) } var showTimeFormat by remember { mutableStateOf(false) } var showTapOpens by remember { mutableStateOf(false) } var showPastEvents by remember { mutableStateOf(false) } @@ -109,6 +115,12 @@ internal fun ViewsScreen( position = Position.Middle, onClick = { showWeekStart = true }, ) + GroupedRow( + title = stringResource(R.string.settings_week_numbering), + summary = weekNumberingLabel(state.weekNumbering), + position = Position.Middle, + onClick = { showWeekNumbering = true }, + ) GroupedRow( title = stringResource(R.string.settings_time_format), summary = timeFormatLabel(state.timeFormat), @@ -339,6 +351,25 @@ internal fun ViewsScreen( onDismiss = { showWeekStart = false }, ) } + if (showWeekNumbering) { + val firstDay = state.weekStart.resolveFirstDay(currentLocale()) + val rowStart = remember(firstDay) { currentDate().startOfWeek(firstDay) } + val region = remember { Resources.getSystem().configuration.locales[0] } + OptionPicker( + title = stringResource(R.string.settings_week_numbering), + header = { GroupedHint(stringResource(R.string.settings_week_numbering_hint), verticalPadding = 8.dp) }, + predictiveBack = true, + options = WeekNumberingPref.entries, + selected = state.weekNumbering, + label = { weekNumberingLabel(it) }, + // Each option shows the number it gives this week, so the difference is visible. + summary = { + stringResource(R.string.settings_week_numbering_this_week, rowWeekNumber(rowStart, it, region)) + }, + onSelect = viewModel::setWeekNumbering, + onDismiss = { showWeekNumbering = false }, + ) + } if (showTimeFormat) { val locale = currentLocale() val systemIs24Hour = DateFormat.is24HourFormat(LocalContext.current) @@ -507,6 +538,15 @@ private fun ViewRow( ) } +@Composable +private fun weekNumberingLabel(pref: WeekNumberingPref): String = stringResource( + when (pref) { + WeekNumberingPref.AUTO -> R.string.settings_week_numbering_auto + WeekNumberingPref.ISO -> R.string.settings_week_numbering_iso + WeekNumberingPref.US -> R.string.settings_week_numbering_us + }, +) + /** Picker options: "Follow system" first, then Monday…Sunday in ISO order. */ private val WEEK_START_OPTIONS: List = listOf(WeekStartPref.Auto) + DayOfWeek.entries.map { WeekStartPref.Day(it) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index eb53ffa0..f75fdc0d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -614,6 +614,12 @@ Currently %1$s Week numbers Show calendar-week numbers in month view + Week numbering + Automatic + ISO 8601 + US + + This week: %1$d Start times Show the start time before an event\'s title when there is room Today button in toolbar @@ -879,6 +885,7 @@ The view Calendula opens on when you start it. The day every week begins on, in all views and widgets. + How week numbers are counted. Automatic follows your region. How times are written throughout the app. Automatic follows your system setting. What the agenda does with events that have already ended. Take the app\'s colours from your wallpaper. diff --git a/app/src/test/java/de/jeanlucmakiola/calendula/ui/common/WeekNumberTest.kt b/app/src/test/java/de/jeanlucmakiola/calendula/ui/common/WeekNumberTest.kt new file mode 100644 index 00000000..7107f79d --- /dev/null +++ b/app/src/test/java/de/jeanlucmakiola/calendula/ui/common/WeekNumberTest.kt @@ -0,0 +1,89 @@ +package de.jeanlucmakiola.calendula.ui.common + +import com.google.common.truth.Truth.assertThat +import de.jeanlucmakiola.calendula.data.prefs.WeekNumberingPref +import de.jeanlucmakiola.calendula.data.prefs.weekFields +import kotlinx.datetime.DateTimeUnit +import kotlinx.datetime.LocalDate +import kotlinx.datetime.minus +import kotlinx.datetime.plus +import kotlinx.datetime.toJavaLocalDate +import org.junit.jupiter.api.Test +import java.util.Locale + +class WeekNumberTest { + + private val portugal = Locale.forLanguageTag("pt-PT") + private val germany = Locale.GERMANY + + @Test + fun `1 January 2026 is week 1 under ISO for every row start`() { + val rows = (0..6).map { LocalDate(2026, 1, 1).minusDays(it) } + rows.forEach { start -> + assertThat(rowWeekNumber(start, WeekNumberingPref.ISO, portugal)).isEqualTo(1) + } + } + + @Test + fun `automatic numbering in Portugal puts 1 January 2026 in week 53`() { + assertThat(rowWeekNumber(LocalDate(2025, 12, 28), WeekNumberingPref.AUTO, portugal)).isEqualTo(53) + assertThat(rowWeekNumber(LocalDate(2025, 12, 29), WeekNumberingPref.AUTO, portugal)).isEqualTo(53) + } + + @Test + fun `automatic numbering in Germany matches ISO`() { + assertThat(WeekNumberingPref.AUTO.weekFields(germany)).isEqualTo(WeekNumberingPref.ISO.weekFields(germany)) + } + + @Test + fun `US numbering puts the week holding 1 January first`() { + assertThat(rowWeekNumber(LocalDate(2025, 12, 28), WeekNumberingPref.US, germany)).isEqualTo(1) + assertThat(rowWeekNumber(LocalDate(2026, 12, 27), WeekNumberingPref.US, germany)).isEqualTo(1) + assertThat(rowWeekNumber(LocalDate(2026, 12, 27), WeekNumberingPref.ISO, germany)).isEqualTo(53) + } + + @Test + fun `US numbering with Monday rows`() { + // Mon 2025-12-29 .. Sun 2026-01-04: its Wednesday is in the US week holding 1 January. + assertThat(rowWeekNumber(LocalDate(2025, 12, 29), WeekNumberingPref.US, germany)).isEqualTo(1) + assertThat(rowWeekNumber(LocalDate(2026, 11, 30), WeekNumberingPref.US, germany)).isEqualTo(49) + } + + @Test + fun `numbering ignores the region unless automatic`() { + val start = LocalDate(2025, 12, 28) + assertThat(rowWeekNumber(start, WeekNumberingPref.ISO, portugal)) + .isEqualTo(rowWeekNumber(start, WeekNumberingPref.ISO, Locale.US)) + assertThat(rowWeekNumber(start, WeekNumberingPref.US, portugal)) + .isEqualTo(rowWeekNumber(start, WeekNumberingPref.US, Locale.US)) + } + + @Test + fun `ISO numbering with Sunday and Saturday rows takes the week holding most of the row`() { + // Sun 01-04 .. Sat 01-10: six days in ISO week 2. + assertThat(rowWeekNumber(LocalDate(2026, 1, 4), WeekNumberingPref.ISO, germany)).isEqualTo(2) + // Sat 01-03 .. Fri 01-09: Monday to Friday are ISO week 2. + assertThat(rowWeekNumber(LocalDate(2026, 1, 3), WeekNumberingPref.ISO, germany)).isEqualTo(2) + // Fri 01-02 .. Thu 01-08: Friday to Sunday are week 1, Monday to Thursday week 2. + assertThat(rowWeekNumber(LocalDate(2026, 1, 2), WeekNumberingPref.ISO, germany)).isEqualTo(2) + } + + @Test + fun `every row gets the number of the week holding at least four of its days`() { + val regions = listOf(germany, Locale.US, portugal) + var start = LocalDate(2019, 12, 20) + while (start < LocalDate(2028, 1, 10)) { + for (numbering in WeekNumberingPref.entries) for (region in regions) { + val fields = numbering.weekFields(region) + val days = (0..6).map { start.plusDays(it).toJavaLocalDate() } + val majority = days.groupingBy { it.get(fields.weekOfWeekBasedYear()) }.eachCount() + .filterValues { it >= 4 }.keys.single() + assertThat(rowWeekNumber(start, numbering, region)).isEqualTo(majority) + } + start = start.plusDays(1) + } + } + + private fun LocalDate.minusDays(days: Int) = minus(days, DateTimeUnit.DAY) + private fun LocalDate.plusDays(days: Int) = plus(days, DateTimeUnit.DAY) +}