However, when I don’t know the date and leave the born variable empty/undefined, I get an error. I tried the following and I thought it would simply display “age unknown” when born is empty:
Hi.
I don’t know why - because in choice(bool, left, right) the main logic should be “if this.born null, choice right” - but in some way it seems to check the “left” expression too.
In that case it fails because it can’t accept “date - null”. It seems a kind of bug.
To bypass this behavior, it’s necessary, in the expression (date(today) - this.born).years, find a away to avoid “this.born” as null if no born value.
Explaining…
With the function default(field, value) → default(this.born, date(today)) - we said: "if this.born null use “date(today)” as value (or date(yesterday) or other valid date… Just to avoid the null. (in this case date value isn’t important, it’s just a away to avoid a false step.)