I think this is because you are trying to call a python method inside a js template.
Use frappe.datetime object instead, you’ll have to implement the last day logic yourself though
In a Jinja template, I want to extract the Year, Month and Date into separate variables from transaction_date (sales order).
For any given document, you can print the Transaction date:
{{ doc.get_formatted("transaction_date") }}
However in my case, I need each date element to fit a pre-printed paper format we have, with the date box pre-formatted. I need to print each element of the date separately. How can I extract the Year, assign to a variable, then the Month to assign to a variable, then the Day to assign to a third variable. Each variable is then printed by itself.
I have tried using datetime objects, and converting to strings using Jinja correct syntax, but no luck.