Calculate persons age and show a tick (check box) if they are less than 65 years old

WordPress
27 November, 2023 09:40:40
todd402
Topics: 2
Messages: 5
Hi, I have users with their date of birth stored as meta data which I can show on a pdf via [e2pdf-user key="birth_date" meta="true"]. I'd like to be able to show a checked tick box if they are older than 65 years. Is there a way I can use [e2pdf-format-date format="Y/m/d" offset="-23742 days"]x[/e2pdf-format-date] and compare the output (23742 days before today) with meta key birth_date to see if birth_date is earlier? i.e. person older than 65 years (or 23742 days).

Many thanks
27 November, 2023 09:42:00
todd402
Topics: 2
Messages: 5
*edit title should read Calculate persons age and show a tick (check box) if they are older than 65 years old
27 November, 2023 11:48:54
E2Pdf
Support
Topics: 7
Messages: 3165
Hello,

If we understand correctly and you need just to tick a checkbox (not output the age), you must be able to use "Actions" and "Conditions", and compare:

[e2pdf-format-date format="Y/m/d" offset="+23742 days"][e2pdf-user key="birth_date" meta="true"][/e2pdf-format-date]

with

[e2pdf-format-date format="Y/m/d"]now[/e2pdf-format-date]

See please the screenshot with setup.
We would really appreciate your feedback at WordPress.org!
28 November, 2023 08:08:32
todd402
Topics: 2
Messages: 5
You understood me correctly and your answer has helped greatly, thank you. I've now got the pdf showing as wanted.