0
I have this condition to show the notification when the expiration date is 30 days away, but it is not doing what I want. Someone has a better idea?
{% if entity.isExpired %}
strong>Alerta!</strong>O produto com o código {{ entity.id }} esta com a data de validade vencida
{% elseif entity.dataentrada == date(entity.isExpired)|date("-30 days") %}
<strong>Alerta!</strong> <a href="{{ path('armazem_showatual', { 'id': entity.id }) }}"> O produto com o código {{ entity.id }} esta com a pouco dias para fechar
{% endif %}
I don’t know how Entity works, but you can get the current date
date('Y-m-d')
, convert the product date in the database to the formatAAAA-MM-DD
with PHPdate_format('01-01-2016', 'Y-m-d')
and calculate the difference between them.– StillBuggin
Goodnight Developed, Entity.isExpired is the expiration date I set when registering a product. and the Entity.datainput is the registration date, it is taken from the database(Timestamp)..
– Zalama
So, you just need to calculate the difference between the expiration date and the current date in days, no?!
– StillBuggin