fix: adjust Git log formatter to fix crash

Fixes: d37fdfdbaa ("fix(app): fully migrate to `java.time`")
This commit is contained in:
Harsh Shandilya
2023-07-26 17:18:49 +05:30
parent 6cb2f2ae77
commit 04a143126b

View File

@@ -12,7 +12,10 @@ import app.passwordstore.databinding.GitLogRowLayoutBinding
import app.passwordstore.util.git.GitCommit import app.passwordstore.util.git.GitCommit
import app.passwordstore.util.git.GitLogModel import app.passwordstore.util.git.GitLogModel
import java.time.Instant import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle
import java.util.Locale
import logcat.LogPriority.ERROR import logcat.LogPriority.ERROR
import logcat.logcat import logcat.logcat
@@ -21,7 +24,10 @@ private fun shortHash(hash: String): String {
} }
private fun stringFrom(date: Instant): String { private fun stringFrom(date: Instant): String {
return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(date) return DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM)
.withLocale(Locale.getDefault())
.withZone(ZoneId.systemDefault())
.format(date)
} }
/** @see GitLogActivity */ /** @see GitLogActivity */