diff --git a/frontend/src/components/DecayInformations/DecayInformation-Long.vue b/frontend/src/components/DecayInformations/DecayInformation-Long.vue index 34f579614..fad50ddab 100644 --- a/frontend/src/components/DecayInformations/DecayInformation-Long.vue +++ b/frontend/src/components/DecayInformations/DecayInformation-Long.vue @@ -25,14 +25,7 @@
{{ $t('decay.past_time') }}
- - {{ duration.years }} {{ $t('decay.year') }}, - {{ duration.months }} {{ $t('decay.months') }}, - {{ duration.days }} {{ $t('decay.days') }}, - {{ duration.hours }} {{ $t('decay.hours') }}, - {{ duration.minutes }} {{ $t('decay.minutes') }}, - {{ duration.seconds }} {{ $t('decay.seconds') }} - + {{ durationText }} @@ -92,6 +85,17 @@ export default { duration() { return this.$moment.duration(new Date(this.decay.end) - new Date(this.decay.start))._data }, + durationText() { + const order = ['years', 'months', 'days', 'hours', 'minutes', 'seconds'] + const result = [] + order.forEach((timeSpan) => { + if (this.duration[timeSpan] > 0) { + const locale = this.$t(`decay.${timeSpan}`) + result.push(`${this.duration[timeSpan]} ${locale}`) + } + }) + return result.join(', ') + }, }, }