We tryed to implement dates on a sales invoice in which we wanted to have the German format dd. MMMM YYYY being e.g. 08. Juli 2017. We used the following in our PrintFormat
frappe.utils.formatdate(doc.get_formatted(‘posting_date’), “dd. MMMM YYYY”)
The result is that it workes in many cases, but it seems, that when it is not 100% clear the engine gets confused. So i f I use 29.06.2017 (06 being june) it will wright 29. June 2017. If I use today date 08.07.2017 it will wright 08. August 2017.
Did you go to Setup>System Settings>Date and Time Format and select the date format that works for you best. Maybe you should try that and then try this again.
Hope this helps.
thank you for your advice.
We have the correct format.
It must lack in function frappe.utils.formatdate or doc.get_formatted. Not clear wich one of those but if we insert the “Date” Datafield instead of custom HTML it works like a charm.
The problem is, we must format the Date to place it correctly - so we need to get custom HTML here.
EDIT: I tried a bit and i can confirm that the function: frappe.utils.formatdate is the problem.
@dominik: Don’t you have the same problem? Have have you overcome or worked around it?
In Case this could help someone:
Rushabh helped us out with this on github:
You are formatting this twice.
If you are using frappe.utils.formatdate, just try using
frappe.utils.formatdate(doc.posting_date, “dd. MMMM YYYY”)
I also thought in that direction, tried doc.get_unformatted but that wont work.
*hoewever → its a typically RTFM Problem
what is the format for time? if we need it till minutes only