fix: Locale warning

This commit is contained in:
J-Jamet 2023-05-14 13:26:23 +02:00
parent 372b2aebe0
commit 7db0c4f7d3

View file

@ -123,19 +123,20 @@ class DateInstant : Parcelable {
}
fun getDateTimeString(resources: Resources): String {
val locale = ConfigurationCompat.getLocales(resources.configuration)[0] ?: Locale.ROOT
return when (mType) {
Type.DATE -> DateFormat.getDateInstance(
DateFormat.MEDIUM,
ConfigurationCompat.getLocales(resources.configuration)[0])
locale)
.format(jDate)
Type.TIME -> DateFormat.getTimeInstance(
DateFormat.SHORT,
ConfigurationCompat.getLocales(resources.configuration)[0])
locale)
.format(jDate)
else -> DateFormat.getDateTimeInstance(
DateFormat.MEDIUM,
DateFormat.SHORT,
ConfigurationCompat.getLocales(resources.configuration)[0])
locale)
.format(jDate)
}
}