Properly remove AM/PM indicator

I observed that the space before the AM/PM indicator was really an NBSP which caused the original pattern to not match.
This pattern, which uses `\s` instead, should match any type of spacing.
This commit is contained in:
Matt Fellenz
2024-01-09 15:16:18 -08:00
parent f51094ed8b
commit 289c0cf66a
@@ -42,7 +42,7 @@ class DateFormatter @Inject constructor(val context: Context) {
formattedPattern = formattedPattern
.replace("h", "HH")
.replace("K", "HH")
.replace(" a".toRegex(), "")
.replace("\\s+a".toRegex(), "")
}
return SimpleDateFormat(formattedPattern, Locale.getDefault())