Date calculation (add 1 year)

February 13, 2023 03:47:55
Colemont
Topics: 7
Messages: 19
Hi guys, i can't manage to calculate date. What i need to is select a date field from questionaire and add 1 year.

Tried this shortcode, but i am getting my calculation as "1971-01-01". Where is the mistake?

[e2pdf-format-date offset="+365 days"][e2pdf-wc-order key="line_item" subkey="Insurance from" index="0" order_item_meta="true"][/e2pdf-format-date]
February 13, 2023 03:49:33
E2Pdf
Topics: 7
Messages: 3617
Support
Hi,

Can you let us know please what is the default output of the shortcode?:

[e2pdf-wc-order key="line_item" subkey="Insurance from" index="0" order_item_meta="true"]

We would really appreciate your feedback at WordPress.org!
February 13, 2023 03:58:30
Colemont
Topics: 7
Messages: 19
For example: 2023.02.14 - it is a date selector from Checkout Field Editor for WooCommerce plugin.
February 13, 2023 04:14:12
E2Pdf
Topics: 7
Messages: 3617
Support
Try to use please construction as follows:

[e2pdf-format-date offset="+365 days"][e2pdf-format-output search="." replace="/"][e2pdf-wc-order key="line_item" subkey="Insurance from" index="0" order_item_meta="true"][/e2pdf-format-output][/e2pdf-format-date]

We would really appreciate your feedback at WordPress.org!
February 13, 2023 04:34:07
Colemont
Topics: 7
Messages: 19
Ok, now the calculation works and i get the result as "2024-02-28" ("-" separator) but i still need to get back to original date format which would be "2024.02.28" ("." separator), how should i modify it?
February 13, 2023 04:34:09
Colemont
Topics: 7
Messages: 19
Ok, now the calculation works and i get the result as "2024-02-28" ("-" separator) but i still need to get back to original date format which would be "2024.02.28" ("." separator), how should i modify it?
February 13, 2023 04:40:50
E2Pdf
Topics: 7
Messages: 3617
Support
It need to use the "format" attribute as:

[e2pdf-format-date format="Y.m.d" offset="+365 days"][e2pdf-format-output search="." replace="/"][e2pdf-wc-order key="line_item" subkey="Insurance from" index="0" order_item_meta="true"][/e2pdf-format-output][/e2pdf-format-date]

We would really appreciate your feedback at WordPress.org!
February 13, 2023 06:11:00
Colemont
Topics: 7
Messages: 19
This doesn't work anymore, i am getting empty field.
February 13, 2023 06:18:05
E2Pdf
Topics: 7
Messages: 3617
Support
Attach please screenshot from the "Value" as it looks like you can miss some quotes.

We would really appreciate your feedback at WordPress.org!
February 13, 2023 06:44:50
Colemont
Topics: 7
Messages: 19
It was my mistake, a quote was missing. Sorry for disturbing. You are epic as always <3
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.