Hide some part of node when the field_countdown timer is zero 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 &lt; 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 ?
You might use twig without method. It will print all configured content to be rendered without the selected fields/properties.

{% set a = 'now'|date("U") %}
{% set b = node.field_timer.value|date("U") %}
{% if a &lt; b %}
    {# Show #}
    {{ content }}
{% else %}
    {# Hide - print the content without the field_timer #}
    {{ content|without('field_timer') }}
{% endif %}


For some cacheability issues it is recommended to always print content.