File: date_interval.test

package info (click to toggle)
php-twig 3.20.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,940 kB
  • sloc: php: 23,320; makefile: 110; sh: 43
file content (17 lines) | stat: -rw-r--r-- 420 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--TEST--
"date" filter (interval support)
--TEMPLATE--
{{ date1|date }}
{{ date1|date('%d days %h hours') }}
{{ date1|date('%d days %h hours', timezone1) }}
--DATA--
date_default_timezone_set('UTC');
return [
    'date1' => new \DateInterval('P2D'),
    // This should have no effect on \DateInterval formatting
    'timezone1' => new \DateTimeZone('America/New_York'),
]
--EXPECT--
2 days
2 days 0 hours
2 days 0 hours