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 }} {{ $t('renderbox.deathdate') + ' ' + deathdate }}
</time> </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> </p>
</div> </div>
</div> </div>
@ -202,24 +202,24 @@ export default {
getUrl: function() { getUrl: function() {
return `/fr/person/${this.person.id}/general`; return `/fr/person/${this.person.id}/general`;
}, },
getAge: function() { // getAge: function() {
// TODO only one abstract function // // TODO only one abstract function
if(this.person.birthdate && !this.person.deathdate){ // if(this.person.birthdate && !this.person.deathdate){
const birthday = new Date(this.person.birthdate.datetime) // const birthday = new Date(this.person.birthdate.datetime)
const now = new Date() // const now = new Date()
return (now.getFullYear() - birthday.getFullYear()) // return (now.getFullYear() - birthday.getFullYear())
} else if(this.person.birthdate && this.person.deathdate){ // } else if(this.person.birthdate && this.person.deathdate){
const birthday = new Date(this.person.birthdate.datetime) // const birthday = new Date(this.person.birthdate.datetime)
const deathdate = new Date(this.person.deathdate.datetime) // const deathdate = new Date(this.person.deathdate.datetime)
return (deathdate.getFullYear() - birthday.getFullYear()) // return (deathdate.getFullYear() - birthday.getFullYear())
} else if(!this.person.birthdate && this.person.deathdate.datetime) { // } else if(!this.person.birthdate && this.person.deathdate.datetime) {
// todo: change this // // todo: change this
return "Age unknown" // return "Age unknown"
} else { // } else {
// todo: change this // // todo: change this
return "Age unknown" // return "Age unknown"
} // }
}, // },
getCurrentHouseholdUrl: function() { getCurrentHouseholdUrl: function() {
let returnPath = this.returnPath ? `?returnPath=${this.returnPath}` : ``; let returnPath = this.returnPath ? `?returnPath=${this.returnPath}` : ``;
return `/fr/person/household/${this.person.current_household_id}/summary${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++){ for(let i = 0; i < this.person.altNames.length; i++){
return this.person.altNames[i].label return this.person.altNames[i].label
} }
console.log(this.person.altNames)
}, },
altNameKey: function() { altNameKey: function() {
for(let i = 0; i < this.person.altNames.length; i++){ for(let i = 0; i < this.person.altNames.length; i++){