Display text by month in any language including offset
I hope someone will find this useful:
Coming from
https://support.zendesk.com/hc/de/community/posts/360036558354-Display-last-month
I created the following to display a month-based text in german. 3 days before a month ends it switches to display next month' text (3 days = 3x86400 seconds = 259200 seconds)
Here we go:
{% assign mon = 'today' | date: "%s" | plus: 259200 | date: "%m" %}
{% case mon %}
{% when '01' %}Happy **January**
{% when '02' %}**Februar** is February in german
...
{% else %}error case - should never be displayed
{% endcase %}
-
This is awesome. Thanks for taking the time to share this Christian!
Vous devez vous connecter pour laisser un commentaire.
1 Commentaires