using serialized age instead of function + translation fix

This commit is contained in:
Julie Lenaerts 2022-01-28 09:57:14 +01:00
parent 6aa1e136b4
commit 0a26e7f326
2 changed files with 19 additions and 20 deletions

View File

@ -47,7 +47,7 @@
{{ $t('renderbox.deathdate') + ' ' + deathdate }}
</time>
<span v-if="options.addAge && person.birthdate" class="age">{{ getAge }} {{ $t('renderbox.years_old')}}</span>
<span v-if="options.addAge && person.birthdate" class="age">{{ $tc('renderbox.years_old', person.age) }}</span>
</p>
</div>
</div>
@ -202,24 +202,24 @@ export default {
getUrl: function() {
return `/fr/person/${this.person.id}/general`;
},
getAge: function() {
// TODO only one abstract function
if(this.person.birthdate && !this.person.deathdate){
const birthday = new Date(this.person.birthdate.datetime)
const now = new Date()
return (now.getFullYear() - birthday.getFullYear())
} else if(this.person.birthdate && this.person.deathdate){
const birthday = new Date(this.person.birthdate.datetime)
const deathdate = new Date(this.person.deathdate.datetime)
return (deathdate.getFullYear() - birthday.getFullYear())
} else if(!this.person.birthdate && this.person.deathdate.datetime) {
// todo: change this
return "Age unknown"
} else {
// todo: change this
return "Age unknown"
}
},
// getAge: function() {
// // TODO only one abstract function
// if(this.person.birthdate && !this.person.deathdate){
// const birthday = new Date(this.person.birthdate.datetime)
// const now = new Date()
// return (now.getFullYear() - birthday.getFullYear())
// } else if(this.person.birthdate && this.person.deathdate){
// const birthday = new Date(this.person.birthdate.datetime)
// const deathdate = new Date(this.person.deathdate.datetime)
// return (deathdate.getFullYear() - birthday.getFullYear())
// } else if(!this.person.birthdate && this.person.deathdate.datetime) {
// // todo: change this
// return "Age unknown"
// } else {
// // todo: change this
// return "Age unknown"
// }
// },
getCurrentHouseholdUrl: function() {
let returnPath = this.returnPath ? `?returnPath=${this.returnPath}` : ``;
return `/fr/person/household/${this.person.current_household_id}/summary${returnPath}`

View File

@ -21,7 +21,6 @@ export default {
for(let i = 0; i < this.person.altNames.length; i++){
return this.person.altNames[i].label
}
console.log(this.person.altNames)
},
altNameKey: function() {
for(let i = 0; i < this.person.altNames.length; i++){