Displaying number of days for payment in invoice

I am creating a custom template for sales invoice and want to display the number of days for the payment to be made.

How do I do that?

I tried doing this {{ due_date | date_to_string }}, but the displayed text is 60.00:00:00, how do I display it as just 60?

I am unable to cast it to string, if someone can help in doing that at least then I can use string operators to get just ‘60’ out of 60.00:00:00.

Thanks. :slight_smile:

This should work, but it doesn’t:

{{ due_date | minus: issue_date | date: "%d" }}

The difference is calculated correctly, but the date filter doesn’t work. Instead of 20 for 20 days, it comes out as a full dateSpan value, 20.00:00:00.

I think Manager uses a limited subset of Liquid filters. @Lubos, is that correct?

Any updates on this please?

Assuming what I wrote above is correct (that Manager used a limited subset of Liquid filters, not including the date filter), you can’t do this programmatically. If you use standard payment terms (like Net 30), then I would suggest you add this information to the Notes section of your invoice (“Payment due within 30 days from original invoice date”).

Why is this important, anyway? The standard Sales Invoice and the default custom template already include the Due Date. How is it better to say X days from invoice date rather than just printing what the actual due date is?

It looks like default implementation doesn’t have in-built formatting for date span.

I’ve added some formatting to Manager, so upgrade to the latest version, then try:

{{ due_date | minus: issue_date | format: "%d" }}