# Custom due date in email template / invoice template

**URL:** <https://forum.manager.io/t/custom-due-date-in-email-template-invoice-template/11268>\
**Category:** Uncategorized\
**Created:** [August 18, 2017, 1:12pm UTC](https://forum.manager.io/t/custom-due-date-in-email-template-invoice-template/11268 "2017-08-18T13:12:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShaneAU](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/shaneau/32/10122_2.png) [@ShaneAU](https://forum.manager.io/u/ShaneAU)\
**Post date:** [August 18, 2017, 1:12pm UTC](https://forum.manager.io/t/custom-due-date-in-email-template-invoice-template/11268/1 "2017-08-18T13:12:42Z")

</div>

Hello all, this is not a question or request - I’m sharing part of what I’ve just built for my email template, in the hope that others will find it useful.

In another post it was explained how to insert the Due Date into an email template:

> [@Adding due date to email template](https://forum.manager.io/t/adding-due-date-to-email-template/10142/2):
>
> {% for field in fields %}{% if field.label == ‘Due date’ %}{{ field.text }}{% endif %}{% endfor %}

However, what I wanted was a specific format that is not supported in the Preferences.

**Format as per Preferences:** 18/08/2017  
**Format I wanted for invoices:** Aug 18, 2017

To achieve this:

Store the due date in a variable:

```
{% for field in fields %}
  {% if field.label == "Due date" %}
    {% capture due_date %}{{ field.text }}{% endcapture %}
  {% endif %}
{% endfor %}

```

Split that variable into three, one to represent each part:

```
{% assign due_date_array = due_date | split: '/' %}
{% assign day = due_date_array[0] %}
{% assign month = due_date_array[1] %}
{% assign year = due_date_array[2] %}

```

**Note:** For the above, if you use the American date format (08/18/2017), swap around the words “day” and “month”. Keep the rest the same.

Convert the month into a textual representation:

```
{% case month %}
  {% when '01' %}
    {% assign month_short = 'Jan' %}
  {% when '02' %}
     {% assign month_short = 'Feb' %}
  {% when '03' %}
     {% assign month_short = 'Mar' %}
  {% when '04' %}
     {% assign month_short = 'Apr' %}
  {% when '05' %}
     {% assign month_short = 'May' %}
  {% when '06' %}
     {% assign month_short = 'Jun' %}
  {% when '07' %}
     {% assign month_short = 'Jul' %}
  {% when '08' %}
     {% assign month_short = 'Aug' %}
  {% when '09' %}
     {% assign month_short = 'Sep' %}
  {% when '10' %}
     {% assign month_short = 'Oct' %}
  {% when '11' %}
     {% assign month_short = 'Nov' %}
  {% when '12' %}
     {% assign month_short = 'Dec' %}
  {% else %}
     {% assign month_short = 'XXX' %}
{% endcase %}

```

**Note:** For the above, if you want the entire name for a month (e.g. ‘January’), simply replace each word.

And now, to actually add it into the invoice:

`Your invoice is due {{month_short}} {{day}}, {{year}}.`

Which renders as:

`Your invoice is due Aug 18, 2017.`

This _should_ also work for invoice templates, but I haven’t tested it in that scenario.

---

<div class="post-metadata">

**Author:** ![Ealfardan](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/ealfardan/32/63166_2.png) [@Ealfardan](https://forum.manager.io/u/Ealfardan)\
**Post date:** [January 18, 2023, 3:25pm UTC](https://forum.manager.io/t/custom-due-date-in-email-template-invoice-template/11268/2 "2023-01-18T15:25:13Z")

</div>

Closed on January 18, 2023, 3:25pm UTC


