From 04a143126baae34922754b59b077259cc8f7dee3 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 26 Jul 2023 17:18:49 +0530 Subject: fix: adjust Git log formatter to fix crash Fixes: d37fdfdbaabe ("fix(app): fully migrate to `java.time`") --- app/src/main/java/app/passwordstore/ui/git/log/GitLogAdapter.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/src/main/java/app/passwordstore/ui/git/log/GitLogAdapter.kt b/app/src/main/java/app/passwordstore/ui/git/log/GitLogAdapter.kt index 9b7b77ed..a6e9180a 100644 --- a/app/src/main/java/app/passwordstore/ui/git/log/GitLogAdapter.kt +++ b/app/src/main/java/app/passwordstore/ui/git/log/GitLogAdapter.kt @@ -12,7 +12,10 @@ import app.passwordstore.databinding.GitLogRowLayoutBinding import app.passwordstore.util.git.GitCommit import app.passwordstore.util.git.GitLogModel import java.time.Instant +import java.time.ZoneId import java.time.format.DateTimeFormatter +import java.time.format.FormatStyle +import java.util.Locale import logcat.LogPriority.ERROR import logcat.logcat @@ -21,7 +24,10 @@ private fun shortHash(hash: String): 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 */ -- cgit v1.2.3