cobalt.rs icon indicating copy to clipboard operation
cobalt.rs copied to clipboard

Formatted dates only supports rendering English words

Open flosse opened this issue 8 years ago • 3 comments

At the moment I'm forced to use %dd %Mon %YYYY %HH:%MM:%SS %zzzz as date format. That's ok for the template header but I'd like to render it in an other format. How would you do this?

flosse avatar Nov 13 '16 11:11 flosse

Ah... here it is: https://help.shopify.com/themes/liquid/filters/additional-filters#date

This is cool but the month name is still in English :-\

flosse avatar Nov 13 '16 11:11 flosse

Can't you simply use %m and print the month no. instead of the month name? :)

johannhof avatar Nov 14 '16 23:11 johannhof

What about:

{% assign month = post.date | date: "%m" %}
                {% case month %}
                    {% when '01' %}
                        Januar
                    {% when '02' %}
                        Februar
                    {% else %}
                        Other
                {% endcase %}

uwearzt avatar Feb 08 '17 19:02 uwearzt