Today's date on the pdf

Divi Forms
January 24, 2020 08:01:52
ionutsabo
Topics: 3
Messages: 8
Hi guys,

So I want to print the current date as dd.mm.yyyy on the pdf and I'm using the code below in the template.



var dt = new Date();
document.getElementById("datetime").innerHTML = (("0"+dt.getDate()).slice(-2)) +"."+ (("0"+(dt.getMonth()+1)).slice(-2)) +"."+ (dt.getFullYear());


The code has worked flawlessly for a couple of months, but lately, it's not updating the date and I'm getting pdfs with an older date that doesn't update.

Any solutions to this?

Thanks again for a great plugin!
January 24, 2020 08:17:35
E2Pdf
Topics: 7
Messages: 3617
Support
Hi,

Are you using this code on form? If so, PDF will output exactly date that was saved while submitting form. To output today dates to PDFs that can be generated in different time you must be able to use shortcode inside template directly:

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

We remain at your service.


We would really appreciate your feedback at WordPress.org!
January 24, 2020 08:29:45
ionutsabo
Topics: 3
Messages: 8
"Are you using this code on form?
If so, PDF will output exactly date that was saved while submitting form."

Yes, that's actually what I wanted to say. Sorry for the confusion.
So I'm using the code from my initial message, but, for some reason, for example, today it would print some previous date on the pdf that I send to the client submitting the form, using the [e2pdf-attachment id="2"] shortcode (2 being the id of my Divi form).

if I, for example, go to the template edit, and edit the field that holds this code, but don't really change anything, it will start again showing the correct date. But that's only until the next day when it will print previous date.

I don't really understand why this is happening, but... yeah... I can do the trick with "editing the template" everyday. Not ideal, but it works for me. i do get daily submissions and this date is important on the pdf.


Thanks again
January 24, 2020 08:48:11
E2Pdf
Topics: 7
Messages: 3617
Support
It looks like issue with javascript / cache / autofill.

Can you check please:

1) If you will include output date field directly to email, will it generate same old date as inside PDF? As it looks not E2Pdf issue as it works with pre-filled fields.

2) You can also try to fill out form in "Private" tab, for example, to see if issue will remain.

We remain at your service.

We would really appreciate your feedback at WordPress.org!
January 24, 2020 08:52:28
ionutsabo
Topics: 3
Messages: 8
Will check on that later today.

I'll probably start using a different form builder, as Divi's is not the most versatile.

Thanks, again!
PS: You may close the topic.
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.