Fix date format of some Asian languages (#1928)

With DateFormat.getBestDateTimePattern to generate best
localized pattern.

Signed-off-by: Yihong Gao <yihong.ui@gmail.com>
This commit is contained in:
Yihong Gao 2020-08-15 14:35:10 -07:00
parent 68d128133c
commit e3b7f167ff
2 changed files with 4 additions and 1 deletions

View File

@ -10,6 +10,7 @@ Improvements 🙌:
- Ensure users do not accidentally ignore other users (#1890)
Bugfix 🐛:
- Fix incorrect date format for some Asian languages (#1928)
- Fix invisible toolbar (Status.im theme) (#1746)
- Fix relative date time formatting (#822)
- Fix crash reported by RageShake

View File

@ -17,6 +17,7 @@
package im.vector.app.core.date
import android.content.Context
import android.text.format.DateFormat
import android.text.format.DateUtils
import im.vector.app.core.resources.LocaleProvider
import org.threeten.bp.LocalDateTime
@ -45,8 +46,9 @@ class VectorDateFormatter @Inject constructor(private val context: Context,
private val messageHourFormatter by lazy {
DateTimeFormatter.ofPattern("H:mm", localeProvider.current())
}
private val messageDayFormatter by lazy {
DateTimeFormatter.ofPattern("EEE d MMM", localeProvider.current())
DateTimeFormatter.ofPattern(DateFormat.getBestDateTimePattern(localeProvider.current(), "EEE d MMM"))
}
fun formatMessageHour(localDateTime: LocalDateTime): String {