fun formatDateTime()

in src/main/kotlin/org/jetbrains/plugins/template/weatherApp/ui/components/WeatherDetailsCard.kt [652:665]


fun formatDateTime(
    dateTime: LocalDateTime,
    showYear: Boolean = true,
    showTime: Boolean = true
): String {
    val dateFormattingPattern = buildString {
        append("dd MMM")
        if (showYear) append(" yyyy")
        if (showTime) append(", HH:mm")
    }

    val formatter = DateTimeFormatter.ofPattern(dateFormattingPattern)
    return dateTime.format(formatter)
}