Capitalize weekday names in the scheduled-message time picker.

This commit is contained in:
Greyson Parrelli
2026-08-10 16:32:54 -04:00
parent d73d1bb741
commit 02e08a3d22
@@ -296,7 +296,9 @@ object DateUtils : android.text.format.DateUtils() {
} else if (isTomorrow(timestamp)) {
context.getString(R.string.DateUtils_tomorrow)
} else {
localDateTime.dayOfWeek.getDisplayName(TextStyle.FULL, Locale.getDefault())
val locale = Locale.getDefault()
// Many locales (e.g. Dutch, French, Spanish) render weekday names in lowercase, but this is used as a standalone label, so we want it capitalized.
localDateTime.dayOfWeek.getDisplayName(TextStyle.FULL, locale).capitalizeFirstChar(locale)
}
val time = localDateTime.toLocalTime().formatHours(context)
return context.getString(R.string.DateUtils_schedule_at, dayModifier, time)
@@ -457,6 +459,13 @@ object DateUtils : android.text.format.DateUtils() {
return this
}
/**
* Uppercases the first character using the rules of the provided [locale]. A no-op for scripts that have no notion of case.
*/
private fun String.capitalizeFirstChar(locale: Locale): String {
return replaceFirstChar { it.titlecase(locale) }
}
private data class TemplateLocale(val template: String, val locale: Locale)
private data class Is24HourDateEntry(val value: Boolean, val lastUpdated: Long)