hoppjan / luebeck-mensa-widget

Android Widget for the Menu of Mensa Lübeck
Apache License 2.0
7 stars 0 forks source link

Fix mensaDay calculation #47

Closed Importantus closed 3 days ago

Importantus commented 4 days ago

Currently, the code for calculating the date for which the meals should be fetched looks like this:

val LocalDateTime.mensaDay: LocalDate
    get() = when {
        date.dayOfWeek == SATURDAY -> date + 2.days
        date.dayOfWeek == SUNDAY || isAfterMensaHours -> date + 1.days
        else -> date
    }

The problem is that isAfterMensaHours -> date + 1.days sets the date on friday to saturday, not the next monday.

hoppjan commented 4 days ago

This should definitely go into v0.0.6

Waiting on the review for #39