Added actor date of birth and death precision.

This commit is contained in:
2026-09-18 23:25:49 +02:00
parent 83c0f1e4c6
commit a9d9b7623d
4 changed files with 92 additions and 14 deletions
+1 -1
Submodule common updated: ec0812ad9d...7df69021ea
+18 -7
View File
@@ -135,13 +135,18 @@ const aliases = Object
<dfn class="bio-label"><Icon icon="cake" />Date of birth</dfn> <dfn class="bio-label"><Icon icon="cake" />Date of birth</dfn>
<span class="birthdate"> <span class="birthdate">
<span class="birthdate-long">{{ formatDate(actor.dateOfBirth, actor.dateOfBirth.getFullYear() > 1 ? 'MMMM d, yyyy' : 'MMMM d') }}</span> <template v-if="actor.dateOfBirthPrecision === 'day'">
<span class="birthdate-short">{{ formatDate(actor.dateOfBirth, actor.dateOfBirth.getFullYear() > 1 ? 'MMM d, yyyy' : 'MMM d') }}</span> <span class="birthdate-long">{{ formatDate(actor.dateOfBirth, actor.dateOfBirth.getFullYear() > 1 ? 'MMMM d, yyyy' : 'MMMM d') }}</span>
<span class="birthdate-short">{{ formatDate(actor.dateOfBirth, actor.dateOfBirth.getFullYear() > 1 ? 'MMM d, yyyy' : 'MMM d') }}</span>
</template>
<span v-else-if="actor.dateOfBirthPrecision === 'month'">{{ formatDate(actor.dateOfBirth, 'MMMM, yyyy') }}</span>
<span v-else-if="actor.dateOfBirth.getFullYear() > 1">{{ formatDate(actor.dateOfBirth, 'yyyy') }}</span>
<span <span
v-if="!actor.dateOfDeath && actor.dateOfBirth.getFullYear() > 1" v-if="!actor.dateOfDeath && actor.dateOfBirth.getFullYear() > 1"
class="age" class="age"
>{{ actor.ageFromBirth }}</span> ><template v-if="actor.ageFromBirthIsApproximate">~</template>{{ actor.ageFromBirth }}</span>
</span> </span>
</li> </li>
@@ -163,10 +168,16 @@ const aliases = Object
> >
<dfn class="bio-label"><Icon icon="tombstone" />Date of death</dfn> <dfn class="bio-label"><Icon icon="tombstone" />Date of death</dfn>
<span class="birthdate">{{ formatDate(actor.dateOfDeath, 'MMMM d, yyyy') }}<span <span class="birthdate">
v-if="actor.ageAtDeath" <span v-if="actor.dateOfDeathPrecision === 'day'">{{ formatDate(actor.dateOfDeath, 'MMMM d, yyyy') }}</span>
class="age" <span v-else-if="actor.dateOfDeathPrecision === 'month'">{{ formatDate(actor.dateOfDeath, 'MMMM, yyyy') }}</span>
>{{ actor.ageAtDeath }}</span></span> <span v-else>{{ formatDate(actor.dateOfDeath, 'yyyy') }}</span>
<span
v-if="actor.ageAtDeath"
class="age"
><template v-if="actor.ageAtDeathIsApproximate">~</template>{{ actor.ageAtDeath }}</span>
</span>
</li> </li>
<li <li
+45 -6
View File
@@ -52,9 +52,12 @@ const fields = computed(() => [
key: 'dateOfBirth', key: 'dateOfBirth',
label: 'date of birth', label: 'date of birth',
type: 'date', type: 'date',
value: actor.value?.dateOfBirth value: {
? format(actor.value.dateOfBirth, 'yyyy-MM-dd') date: actor.value?.dateOfBirth
: null, ? format(actor.value.dateOfBirth, 'yyyy-MM-dd')
: null,
precision: actor.value.dateOfBirthPrecision,
},
inline: true, inline: true,
}, },
{ {
@@ -212,9 +215,12 @@ const fields = computed(() => [
key: 'dateOfDeath', key: 'dateOfDeath',
label: 'date of death', label: 'date of death',
type: 'date', type: 'date',
value: actor.value?.dateOfDeath value: {
? format(actor.value.dateOfDeath, 'yyyy-MM-dd') date: actor.value?.dateOfDeath
: null, ? format(actor.value.dateOfDeath, 'yyyy-MM-dd')
: null,
precision: actor.value.dateOfDeathPrecision,
},
}, },
{ {
key: 'allowGlobalMatch', key: 'allowGlobalMatch',
@@ -270,6 +276,14 @@ const keyMap = {
country: 'residenceCountry', country: 'residenceCountry',
place: 'residencePlace', place: 'residencePlace',
}, },
dateOfBirth: {
date: 'dateOfBirth',
precision: 'dateOfBirthPrecision',
},
dateOfDeath: {
date: 'dateOfDeath',
precision: 'dateOfDeathPrecision',
},
tattoos: { tattoos: {
has: 'hasTattoos', has: 'hasTattoos',
description: 'tattoos', description: 'tattoos',
@@ -501,6 +515,7 @@ async function submit() {
>{{ item.unit }} >{{ item.unit }}
</template> </template>
<!--
<input <input
v-if="item.type === 'date'" v-if="item.type === 'date'"
v-model="edits[item.key]" v-model="edits[item.key]"
@@ -508,6 +523,30 @@ async function submit() {
class="date input" class="date input"
:disabled="!editing.has(item.key)" :disabled="!editing.has(item.key)"
> >
-->
<div
v-if="item.type === 'date'"
class="date"
>
<input
v-model="edits[item.key].date"
type="date"
class="date input"
:disabled="!editing.has(item.key)"
>
<select
v-if="item.value.precision"
v-model="edits[item.key].precision"
class="input"
:disabled="!editing.has(item.key)"
>
<option value="day">Day</option>
<option value="month">Month</option>
<option value="year">Year</option>
</select>
</div>
<select <select
v-if="item.type === 'select'" v-if="item.type === 'select'"
+28
View File
@@ -32,7 +32,9 @@ const mj = new MerkleJson();
const keyMap = { const keyMap = {
avatar: 'avatar_media_id', avatar: 'avatar_media_id',
dateOfBirth: 'date_of_birth', dateOfBirth: 'date_of_birth',
dateOfBirthPrecision: 'date_of_birth_precision',
dateOfDeath: 'date_of_death', dateOfDeath: 'date_of_death',
dateOfDeathPrecision: 'date_of_death_precision',
originCountry: 'birth_country_alpha2', originCountry: 'birth_country_alpha2',
originState: 'birth_state', originState: 'birth_state',
originCity: 'birth_city', originCity: 'birth_city',
@@ -62,6 +64,24 @@ const keyMap = {
const socialsOrder = ['onlyfans', 'fansly', 'twitter', 'instagram', 'loyalfans', 'manyvids', 'pornhub', 'linktree', null]; const socialsOrder = ['onlyfans', 'fansly', 'twitter', 'instagram', 'loyalfans', 'manyvids', 'pornhub', 'linktree', null];
// with month (but not day) precision on either side, the age is still certain unless both dates fall in the same month,
// since only then could the unknown day(s) put the birthday on either side of the reference date
function isAgeApproximate(baseDate, basePrecision, referenceDate, referencePrecision = 'day') {
if (!baseDate || !referenceDate) {
return false;
}
if (basePrecision === 'year' || referencePrecision === 'year') {
return true;
}
if (basePrecision === 'day' && referencePrecision === 'day') {
return false;
}
return baseDate.getMonth() === referenceDate.getMonth();
}
export function curateActor(actor, context = {}) { export function curateActor(actor, context = {}) {
if (!actor) { if (!actor) {
return null; return null;
@@ -97,14 +117,20 @@ export function curateActor(actor, context = {}) {
ageFromBirth: actor.date_of_birth && actor.date_of_birth.getFullYear() > 1 ageFromBirth: actor.date_of_birth && actor.date_of_birth.getFullYear() > 1
? differenceInYears(Date.now(), actor.date_of_birth) ? differenceInYears(Date.now(), actor.date_of_birth)
: null, : null,
ageFromBirthIsApproximate: actor.date_of_birth_precision !== 'day'
&& isAgeApproximate(actor.date_of_birth, actor.date_of_birth_precision, new Date()),
ageAtDeath: actor.date_of_birth && actor.date_of_death && actor.date_of_birth.getFullYear() > 1 ageAtDeath: actor.date_of_birth && actor.date_of_death && actor.date_of_birth.getFullYear() > 1
? differenceInYears(actor.date_of_death, actor.date_of_birth) ? differenceInYears(actor.date_of_death, actor.date_of_birth)
: null, : null,
ageAtDeathIsApproximate: (actor.date_of_birth_precision !== 'day' || actor.date_of_death_precision !== 'day')
&& isAgeApproximate(actor.date_of_birth, actor.date_of_birth_precision, actor.date_of_death, actor.date_of_death_precision),
ageThen: context.sceneDate && actor.date_of_birth && actor.date_of_birth.getFullYear() > 1 ageThen: context.sceneDate && actor.date_of_birth && actor.date_of_birth.getFullYear() > 1
? differenceInYears(context.sceneDate, actor.date_of_birth) ? differenceInYears(context.sceneDate, actor.date_of_birth)
: null, : null,
dateOfBirth: actor.date_of_birth, dateOfBirth: actor.date_of_birth,
dateOfBirthPrecision: actor.date_of_birth_precision,
dateOfDeath: actor.date_of_death, dateOfDeath: actor.date_of_death,
dateOfDeathPrecision: actor.date_of_death_precision,
bust: actor.bust, bust: actor.bust,
cup: actor.cup, cup: actor.cup,
waist: actor.waist, waist: actor.waist,
@@ -1185,7 +1211,9 @@ async function applyActorRevision(revisionIds, reqUser) {
'gender', 'gender',
'avatar', 'avatar',
'dateOfBirth', 'dateOfBirth',
'dateOfBirthPrecision',
'dateOfDeath', 'dateOfDeath',
'dateOfDeathPrecision',
'originCountry', 'originCountry',
'originState', 'originState',
'originCity', 'originCity',