diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/extensions/DateExtensions.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/extensions/DateExtensions.kt index 4b29ed42e..1e4dac718 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/extensions/DateExtensions.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/extensions/DateExtensions.kt @@ -2,6 +2,7 @@ package com.habitrpg.android.habitica.extensions import android.content.res.Resources import com.habitrpg.android.habitica.R +import com.habitrpg.common.habitica.helpers.LanguageHelper import java.text.DateFormat import java.text.SimpleDateFormat import java.util.Calendar @@ -173,7 +174,7 @@ fun Duration.getMinuteOrSeconds(): DurationUnit { } fun Date.formatForLocale(): String { - val locale = Locale.getDefault() + val locale = LanguageHelper.systemLocale val dateFormatter: DateFormat = if (locale == Locale.US || locale == Locale.ENGLISH) { SimpleDateFormat("M/d/yy", locale) diff --git a/common/src/main/java/com/habitrpg/common/habitica/helpers/LanguageHelper.kt b/common/src/main/java/com/habitrpg/common/habitica/helpers/LanguageHelper.kt index 70ac35e89..eed7c85ac 100644 --- a/common/src/main/java/com/habitrpg/common/habitica/helpers/LanguageHelper.kt +++ b/common/src/main/java/com/habitrpg/common/habitica/helpers/LanguageHelper.kt @@ -43,6 +43,10 @@ class LanguageHelper(languageSharedPref: String?) { companion object { // Intentional, we want the system locale, not the app locale @SuppressLint("ConstantLocale") - val systemLocale = Locale.getAvailableLocales().firstOrNull() ?: Locale.getDefault() + val systemLocale: Locale + + init { + systemLocale = Locale.getDefault() + } } }