Skip to content

Commit

Permalink
🔧 Fix Fixed to display both day and month in two digits.
Browse files Browse the repository at this point in the history
  • Loading branch information
Corvus400 committed Sep 26, 2022
1 parent d024cea commit e58c186
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit e58c186

Please sign in to comment.