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?
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?