diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/presencetracing/attendee/checkins/common/CompletedCheckIn.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/presencetracing/attendee/checkins/common/CompletedCheckIn.kt index e5679346f5f9a930e8c768e298f24a25ec716514..f1fcbae5909a3f39f3e823e58840f20972981252 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/presencetracing/attendee/checkins/common/CompletedCheckIn.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/ui/presencetracing/attendee/checkins/common/CompletedCheckIn.kt @@ -9,8 +9,19 @@ inline val CheckIn.checkoutInfo: String val checkInStartUserTZ = checkInStart.toUserTimeZone() val checkInEndUserTZ = checkInEnd.toUserTimeZone() - val dayFormatted = checkInStartUserTZ.toLocalDate().toString(DateTimeFormat.mediumDate()) - val startTimeFormatted = checkInStartUserTZ.toLocalTime().toString(DateTimeFormat.shortTime()) - val endTimeFormatted = checkInEndUserTZ.toLocalTime().toString(DateTimeFormat.shortTime()) - return "$dayFormatted, $startTimeFormatted - $endTimeFormatted" + return if (checkInStartUserTZ.toLocalDate() == checkInEndUserTZ.toLocalDate()) { + val dateFormat = DateTimeFormat.shortDate() + val timeFormat = DateTimeFormat.shortTime() + val dayFormatted = checkInStartUserTZ.toString(dateFormat) + val startTimeFormatted = checkInStartUserTZ.toString(timeFormat) + val endTimeFormatted = checkInEndUserTZ.toString(timeFormat) + + String.format("%s, %s - %s", dayFormatted, startTimeFormatted, endTimeFormatted) + } else { + val dateTimeFormat = DateTimeFormat.shortDateTime() + val startTimeFormatted = checkInStartUserTZ.toString(dateTimeFormat) + val endTimeFormatted = checkInEndUserTZ.toString(dateTimeFormat) + + String.format("%s - %s", startTimeFormatted, endTimeFormatted) + } }