Skip to content

Commit

Permalink
fix: when birth_date is present, include age_over_NN only for `or…
Browse files Browse the repository at this point in the history
…g.iso.18013.5.1` namespace (#35)
  • Loading branch information
siacomuzzi authored Dec 30, 2024
1 parent 0160c1d commit facf6eb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mdoc/model/Document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ export class Document {

for (const [key, value] of Object.entries(values)) {
addAttribute(key, value);
if (key === 'birth_date') {

if (key === 'birth_date' && namespace === DEFAULT_NS) {
const ageInYears = getAgeInYears(value);
addAttribute('age_over_21', ageInYears >= 21);
addAttribute(`age_over_${Math.floor(ageInYears)}`, true);
Expand Down

0 comments on commit facf6eb

Please sign in to comment.