Skip to content

Commit

Permalink
refactor: Rename formatPastDate into defaultFormatting for a more pre…
Browse files Browse the repository at this point in the history
…cision namming

The method does format future dates in a specific way so it can't be called "formatPastDate"
  • Loading branch information
LunarX committed Feb 17, 2025
1 parent d935019 commit 99141e0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import java.util.Date
enum class DateDisplay(@DrawableRes val icon: Int?, val formatDate: Context.(RealmInstant) -> String) {
Default(
icon = null,
formatDate = { date -> formatPastDate(date) }
formatDate = { date -> defaultFormatting(date) }
),
Scheduled(
icon = R.drawable.ic_scheduled_messages,
Expand All @@ -49,7 +49,7 @@ private fun Context.formatRelativeFutureDate(date: RealmInstant) = DateUtils.get
DateUtils.FORMAT_SHOW_YEAR or DateUtils.FORMAT_ABBREV_MONTH,
)?.toString() ?: ""

private fun Context.formatPastDate(date: RealmInstant) = with(date.toDate()) {
private fun Context.defaultFormatting(date: RealmInstant) = with(date.toDate()) {
when {
isInTheFuture() -> formatNumericalDayMonthYear()
isToday() -> format(FORMAT_DATE_HOUR_MINUTE)
Expand Down

0 comments on commit 99141e0

Please sign in to comment.