From e58c1860fc85f7c44e7268bc042b2729932e51e0 Mon Sep 17 00:00:00 2001 From: todayama_r <13657682+Corvus400@users.noreply.github.com> Date: Mon, 26 Sep 2022 16:19:32 +0900 Subject: [PATCH] :wrench: Fix Fixed to display both day and month in two digits. --- .../confsched2022/feature/announcement/Announcements.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/feature/announcement/src/main/java/io/github/droidkaigi/confsched2022/feature/announcement/Announcements.kt b/feature/announcement/src/main/java/io/github/droidkaigi/confsched2022/feature/announcement/Announcements.kt index 82547aa89..b479576d8 100644 --- a/feature/announcement/src/main/java/io/github/droidkaigi/confsched2022/feature/announcement/Announcements.kt +++ b/feature/announcement/src/main/java/io/github/droidkaigi/confsched2022/feature/announcement/Announcements.kt @@ -265,10 +265,13 @@ private fun LocalDate.convertString(): String { } else if (this.compareTo(yesterday) == 0) { stringResource(Strings.announcement_content_header_title_yesterday) } else { - "${this.year}/${this.month.value.toString().padStart(2, '0')}/${this.dayOfMonth}" + "${this.year}/${this.month.value.padDayOrMonth()}/${this.dayOfMonth.padDayOrMonth()}" } } +private fun Int.padDayOrMonth(): String = + this.toString().padStart(2, '0') + @Preview(showBackground = true) @Composable fun AnnouncementsPreview() {