From 3b98443f9ec9ccd434c8a0b94995a49f407a86c5 Mon Sep 17 00:00:00 2001 From: Pablo Pajuelo Cabezas Date: Mon, 23 Dec 2024 13:25:03 +0100 Subject: [PATCH] fix min period date calculation --- .../org/dhis2/commons/periods/data/EventPeriodRepository.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commons/src/main/java/org/dhis2/commons/periods/data/EventPeriodRepository.kt b/commons/src/main/java/org/dhis2/commons/periods/data/EventPeriodRepository.kt index 6270073964..e13b487cf4 100644 --- a/commons/src/main/java/org/dhis2/commons/periods/data/EventPeriodRepository.kt +++ b/commons/src/main/java/org/dhis2/commons/periods/data/EventPeriodRepository.kt @@ -38,10 +38,10 @@ class EventPeriodRepository(private val d2: D2) { generatePeriod(PeriodType.Daily, currentPeriod.startDate()!!, expiryDays ?: 0) .startDate() - return if (currentDate.after(previousPeriodLastDay)) { + return if (currentDate.after(previousPeriodLastDay) or (currentDate == previousPeriodLastDay)) { currentPeriod.startDate() } else { - generatePeriod(periodType, offset = -1).startDate() + generatePeriod(periodType, currentDate, offset = -1).startDate() } ?: Date() }