fix(ui): Show event dates in card view

The EventCard had a fixed 120dp height that clipped the date line.
Remove the height constraint so the card grows to fit all content,
and format ISO datetime strings into readable dd.MM.yyyy HH:mm format.
This commit is contained in:
2026-08-04 09:57:47 +02:00
parent ed97b2a1f0
commit a8905327f0
3 changed files with 105 additions and 7 deletions
@@ -0,0 +1,60 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// MyIce Kotlin Multiplatform — schedule/convocation viewer
// Copyright (C) 2026 parano.ch
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package ch.parano.myice.util
import kotlin.test.Test
import kotlin.test.assertEquals
class EventDateTimeFormatterTest {
@Test
fun formatsSameDayEventAsDateFollowedByTimeRange() {
val formatted = formatEventDateTime(
start = "2024-11-10T14:00:00",
end = "2024-11-10T16:15:00",
)
assertEquals("10.11.2024 14:00 - 16:15", formatted)
}
@Test
fun formatsCrossingMidnightEventWithBothDates() {
val formatted = formatEventDateTime(
start = "2024-11-10T20:00:00",
end = "2024-11-11T01:30:00",
)
assertEquals("10.11.2024 20:00 - 01:30 (11.11.2024)", formatted)
}
@Test
fun returnsRawStartWhenStartUnparseable() {
val formatted = formatEventDateTime(start = "s", end = "2024-11-10T16:15:00")
assertEquals("s - 2024-11-10T16:15:00", formatted)
}
@Test
fun returnsRawEndWhenEndUnparseable() {
val formatted = formatEventDateTime(start = "2024-11-10T14:00:00", end = "e")
assertEquals("2024-11-10T14:00:00 - e", formatted)
}
@Test
fun returnsRawWhenBothUnparseable() {
val formatted = formatEventDateTime(start = "s", end = "e")
assertEquals("s - e", formatted)
}
}