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

WordPress
November 27, 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
November 27, 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
November 27, 2023 11:48:54
E2Pdf
Topics: 7
Messages: 3617
Support
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!
November 28, 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.
Get News and Updates
Our monthly newsletter keeps you in the loop, so you'll always be up to date with the latest news and updates about E2Pdf.
* You can update your email subscription preferences here.
All trademarks, service marks, trade names, product names, and logos appearing on this website are the property of their respective owners. The use of trademarks such as Formidable Forms®, Forminator Forms®, Gravity Forms®, JetFormBuilder®, WordPress®, WooCommerce®, WPForms® and others is solely for identification purposes (nominative use) and does not imply any affiliation, sponsorship, or endorsement by the respective trademark holders.
© 2017 - 2026, https://e2pdf.com

We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. By clicking "Accept Selected", you consent to use of selected cookies according to our Cookie Policy.