0

i have many orders, each order has two fields for store the time of steps done. the Variables set in Controller PHP

timeStartOrder = date('H:i:s') .... timeEndOrder = date('H:i:s')

But how i render in twig the calculate diff between the time in twig?

{{ timeStartOrder=timeEndOrder|time_diff}} dont work!

phzao
  • 81
  • 1
  • 2
  • 9

1 Answers1

4

You said "don't work". But, do you any any error message ?

To calculate the difference between two dates, you have to create a function. In your case a twig extension.

Of course, the function "time_diff" exist in the native support. See these topics:

Install the correct libraries, and the twig extension to load this module.

Community
  • 1
  • 1
Georges O.
  • 972
  • 1
  • 9
  • 21