Do not append 0 values when formatting duration

This commit is contained in:
Maxime NATUREL 2022-04-12 15:21:30 +02:00
parent c432985cb4
commit 8b628229ed

View File

@ -93,15 +93,21 @@ object TextUtils {
when { when {
hours > 0 -> { hours > 0 -> {
appendHours(context, builder, hours) appendHours(context, builder, hours)
builder.append(" ") if(minutes > 0) {
appendMinutes(context, builder, minutes) builder.append(" ")
builder.append(" ") appendMinutes(context, builder, minutes)
appendSeconds(context, builder, seconds) }
if(seconds > 0) {
builder.append(" ")
appendSeconds(context, builder, seconds)
}
} }
minutes > 0 -> { minutes > 0 -> {
appendMinutes(context, builder, minutes) appendMinutes(context, builder, minutes)
builder.append(" ") if(seconds > 0) {
appendSeconds(context, builder, seconds) builder.append(" ")
appendSeconds(context, builder, seconds)
}
} }
else -> { else -> {
appendSeconds(context, builder, seconds) appendSeconds(context, builder, seconds)