Merge pull request #1930 from yh-gao/best_localized_date_format

Fix date format for some Asian languages (#1928)
This commit is contained in:
Benoit Marty 2020-08-17 23:57:40 +02:00 committed by GitHub
commit a9ad3ac4f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -11,6 +11,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 {