Skip to content

Commit

Permalink
Show year if not same year
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwalter authored and prof18 committed Jan 2, 2025
1 parent d8a66e9 commit cde1646
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,17 +367,31 @@ class DateFormatter(
)

val isToday = today == localDate
val isThisYear = today.year == localDate.year

val dateFormat = if (isToday) {
LocalDateTime.Format {
hour()
char(':')
minute()
}
} else if (isThisYear) {
LocalDateTime.Format {
dayOfMonth()
char('/')
monthNumber()
chars(" - ")
hour()
char(':')
minute()
}
} else {
LocalDateTime.Format {
dayOfMonth()
char('/')
monthNumber()
char('/')
year()
chars(" - ")
hour()
char(':')
Expand Down

0 comments on commit cde1646

Please sign in to comment.