Update age representation in DashboardWidget: Modify falukantAgeLabel computed property to display age in days if less than a year, otherwise show in years. Add localization for "days" in both German and English language files to support the new age format.
This commit is contained in:
@@ -122,10 +122,16 @@ export default {
|
||||
return t === key ? this.$t(`general.gender.${g}`) || g : t;
|
||||
},
|
||||
falukantAgeLabel() {
|
||||
const days = this.falukantData?.age;
|
||||
if (days == null) return '—';
|
||||
const years = Math.floor(Number(days) / 365);
|
||||
return `${years} ${this.$t('falukant.overview.metadata.years')}`;
|
||||
const ageValue = this.falukantData?.age;
|
||||
if (ageValue == null) return '—';
|
||||
const numAge = Number(ageValue);
|
||||
// Backend gibt Tage zurück (calcAge verwendet differenceInDays)
|
||||
// Wenn < 365 Tage: Tage anzeigen, sonst Jahre
|
||||
if (numAge < 365) {
|
||||
return `${numAge} ${this.$t('falukant.overview.metadata.days')}`;
|
||||
} else {
|
||||
return `${numAge} ${this.$t('falukant.overview.metadata.years')}`;
|
||||
}
|
||||
},
|
||||
dataList() {
|
||||
if (!Array.isArray(this.data) || this.data.length === 0) return [];
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
"money": "Vermögen",
|
||||
"age": "Alter",
|
||||
"years": "Jahre",
|
||||
"days": "Tage",
|
||||
"mainbranch": "Heimatstadt",
|
||||
"nobleTitle": "Stand"
|
||||
},
|
||||
|
||||
@@ -101,6 +101,7 @@
|
||||
"money": "Wealth",
|
||||
"age": "Age",
|
||||
"years": "Years",
|
||||
"days": "Days",
|
||||
"mainbranch": "Home city",
|
||||
"nobleTitle": "Title"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user