Skip to content

Consolidate date section formatter across Android lists#300

Merged
gemcoder21 merged 3 commits into
mainfrom
285-consolidate-date-section-formatter
May 12, 2026
Merged

Consolidate date section formatter across Android lists#300
gemcoder21 merged 3 commits into
mainfrom
285-consolidate-date-section-formatter

Conversation

@DRadmir
Copy link
Copy Markdown
Contributor

@DRadmir DRadmir commented May 12, 2026

Extract today/yesterday handling and localized long date formatting into a reusable SectionDateFormatter so it draws on app translations instead of DateUtils system strings. Reuse it in DateGroupedList and RecentsBottomSheet, and cover the date branching with a unit test.

Closes #285

Extract today/yesterday handling and localized long date formatting
into a reusable SectionDateFormatter so it draws on app translations
instead of DateUtils system strings. Reuse it in DateGroupedList and
RecentsBottomSheet, and cover the date branching with a unit test.

Closes #285
@DRadmir DRadmir self-assigned this May 12, 2026
}
val title = SectionDateFormatter.format(
timestamp = timestamp,
todayLabel = stringResource(R.string.date_today),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move today and yesterday to config

today = LocalDate.now(clock),
)

fun format(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this one used anywhere?

@@ -157,25 +156,22 @@ private fun buildDateSections(
if (items.isEmpty()) return emptyList()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use dateGroupedList

DRadmir added 2 commits May 12, 2026 21:50
Turn SectionDateFormatter into a class that takes today/yesterday
labels in the constructor and exposes a single format(LocalDate, Locale)
method. Group items by LocalDate directly in dateGroupedList and drop
the Calendar/end-of-day workaround. Replace RecentsBottomSheet's custom
sections with a direct dateGroupedList call.
@gemcoder21 gemcoder21 merged commit 6362cd4 into main May 12, 2026
4 of 5 checks passed
@gemcoder21 gemcoder21 deleted the 285-consolidate-date-section-formatter branch May 12, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate Date section formatter

2 participants