I create a field with field_countdown. Now I want hide some part of my node text when the timer is zero.
For this when I use this code:
{% set a = 'now'|date("U") %}
{% set b = node.field_timer.value|date("U") %}
{% if a < b %}
Show
{% else %}
Hide
{% endif %}
Work but not currectly. And in first page send me an error.
The website encountered an unexpected error. Please try again later. TypeError: DateTime::__construct() expects parameter 1 to be string, array given in DateTime->__construct() (line 519 of vendor\twig\twig\lib\Twig\Extension\Core.php).
In second way I create a field like my field_timer and just show secondes and after my timer show zero IF command work but in this way I add a field and it's not good.
How can I do this with other codes in Drupal 8 ?
node.field_timer.value
?{{ dump(node.field_timer.value)}}
you should be able to identify the proper key to use for the filter date|date("U")