E
E
eastward2018-08-20 10:26:51
Twig
eastward, 2018-08-20 10:26:51

How to display text by condition in a date range?

Hello!
It is required to set up sending emails on events, with different texts depending on the type of delivery and the time of the order in the online store.
The service on which I set up letters support twig template engine.
There was a task that I could neither google nor understand on my own, since I am not familiar with programming languages.
It is required to change the text in the letter depending on the time of the order.
During working hours from 8 to 17 - one text
In other cases - another

{% if order.createdAt|period|number(date('%H:%i', 'Europe/Moscow')) --- ??? %}
<p>Заказ в рабочее время</p>
{% else %}
<p>Заказ в нерабочее время</p>
{% endif %}

I do not understand how to make a filter by time - please tell me. At least in what direction to search and what query to enter into search engines

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question