Merge branch 'fix_display_dates' into 'master'

Correct formatting of birth- and deathdate

See merge request Chill-Projet/chill-bundles!185
This commit is contained in:
Julien Fastré 2021-10-27 10:17:16 +00:00
commit c4c75199d6

View File

@ -35,7 +35,7 @@
</time> </time>
<time v-else-if="person.birthdate && person.deathdate" :datetime="person.deathdate" :title="person.deathdate"> <time v-else-if="person.birthdate && person.deathdate" :datetime="person.deathdate" :title="person.deathdate">
{{ birthdate }} - {{ deathdate }} {{ $d(birthdate) }} - {{ $d(deathdate) }}
</time> </time>
<time v-else-if="person.deathdate" :datetime="person.deathdate" :title="person.deathdate"> <time v-else-if="person.deathdate" :datetime="person.deathdate" :title="person.deathdate">
@ -163,22 +163,15 @@ export default {
return this.person.gender === 'woman' ? 'person.gender.woman' : this.person.gender === 'man' ? 'person.gender.man' : 'person.gender.neuter'; return this.person.gender === 'woman' ? 'person.gender.woman' : this.person.gender === 'man' ? 'person.gender.man' : 'person.gender.neuter';
}, },
birthdate: function(){ birthdate: function(){
if(this.person.birthdate !== null){ if(this.person.birthdate !== null || this.person.birthdate === "undefined"){
const date = new Date(this.person.birthdate.datetime); return new Date(this.person.birthdate.datetime);
return dateToISO(date)
} else { } else {
return ""; return "";
} }
}, },
deathdate: function(){ deathdate: function(){
// TODO FIX edition conflict: if null or undefined ? if(this.person.deathdate !== null || this.person.birthdate === "undefined"){
// if (typeof this.person.deathdate !== 'undefined') { return new Date(this.person.deathdate.datetime);
// var date = new Date(this.person.deathdate.datetime);
// return dateToISO(date);
//}
if(this.person.deathdate !== null){
const date = new Date(this.person.deathdate.datetime);
return date.toLocaleDateString("fr-FR");
} else { } else {
return ""; return "";
} }