Displaying Dates in Other Formats

By default, Clientary templates use English formatted dates. For example, the Invoice Date is rendered in Liquid as:

{{ invoice.date | date: "%B %e, %Y" }}

date accepts the same parameters as Ruby's strftime method. You can find a list of the shorthand formats in Ruby's documentation or use a site like strfti.me.

You can customize the output to something more appropriate for your locale by using Liquid as well. For example, this will output a customized Month:

{% assign m = invoice.date | date: "%-m" %}
{% case m %}
  {% when '1' %}Januar
  {% when '2' %}Februar
  {% when '3' %}März
  {% when '4' %}April
  {% when '5' %}Mai
  {% when '6' %}Juni
  {% when '7' %}Juli
  {% when '8' %}August
  {% when '9' %}September
  {% when '10' %}Oktober
  {% when '11' %}November
  {% when '12' %}Dezember
{% endcase %}

You can repeat this for date and year as necessary using %-d and %-Y, respectively.

Contact Us

Not finding what you're looking for? Contact Us Directly