Closed (fixed)
Project:
Drupal core
Version:
9.4.x-dev
Component:
other
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 May 2022 at 20:20 UTC
Updated:
13 Jul 2022 at 02:29 UTC
Jump to comment: Most recent
Comments
Comment #2
stinky commentedComment #3
cilefen commentedDoes this answer your question? https://stackoverflow.com/questions/15657687/twig-date-difference
Comment #4
stinky commentedNot really, lol. I', completely new to Twig.
Here's what I tried-- and it doesn't work.
{% set var1 = field_cp1_time_out_1|date("H:i:s") %}
{% set var2 = field_cp1_time_in_1|date("H:i:s") %}
{% set difference = date(var1).diff(date(var2)) %}
{{ difference }}
Comment #5
cilefen commentedI strongly suggest you ask at https://drupal.stackexchange.com/.
Comment #6
cilefen commentedI urge you to use the better support resources.
Comment #7
cilefen commentedSorry: I didn't mean to just close this and I added a webform queue triage message although this is in Drupal Core! I've removed that. But the bottom line is that the Drupal Core issue queue is not ideal for support requests because they usually go unanswered here.
Comment #9
nelo_drup commentedSame problem using diff produces the following error
Calling "diff" method on a "DateTime" object is not allowed in
Comment #10
cilefen commentedhttps://stackoverflow.com/questions/15657687/twig-date-difference