From 289c0cf66ae77912ffb20d0d234990045098ee35 Mon Sep 17 00:00:00 2001 From: Matt Fellenz Date: Tue, 9 Jan 2024 15:16:18 -0800 Subject: [PATCH] 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. --- .../src/main/java/com/moez/QKSMS/common/util/DateFormatter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/common/util/DateFormatter.kt b/presentation/src/main/java/com/moez/QKSMS/common/util/DateFormatter.kt index b032202f..66eca516 100644 --- a/presentation/src/main/java/com/moez/QKSMS/common/util/DateFormatter.kt +++ b/presentation/src/main/java/com/moez/QKSMS/common/util/DateFormatter.kt @@ -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())