1--TEST--
2RFC: DateTime and Daylight Saving Time Transitions (zone type 3, bd2)
3--CREDITS--
4Daniel Convissor <danielc@php.net>
5--XFAIL--
6Still not quite right
7--FILE--
8<?php
9
10date_default_timezone_set('America/New_York');
11$date_format = 'Y-m-d H:i:s T e';
12$interval_format = 'P%dDT%hH';
13
14/*
15 * For backward transitions, must create objects with zone type 2
16 * where specifying Daylight or Standard time is required
17 * then converting them to zone type 3.
18 */
19
20$tz = new DateTimeZone('America/New_York');
21
22/*
23 * Backward Transitions, diff().
24 */
25
26$end   = new DateTime('2010-11-07 05:30:00');
27$end->setTimeZone($tz);
28$start = new DateTime('2010-11-06 04:30:59');
29echo 'bd0 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
30	. ' = ' . $start->diff($end)->format('P%dDT%hH%iM%sS') . "\n";
31
32$end   = new DateTime('2010-11-07 01:30:00 EST');
33$end->setTimeZone($tz);
34$start = new DateTime('2010-11-06 04:30:00');
35echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
36	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
37
38$end   = new DateTime('2010-11-07 01:30:00 EDT');
39$end->setTimeZone($tz);
40$start = new DateTime('2010-11-06 04:30:00');
41echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
42	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
43
44$end   = new DateTime('2010-11-07 01:30:00 EST');
45$end->setTimeZone($tz);
46$start = new DateTime('2010-11-06 01:30:00');
47echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
48	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
49
50echo "\n";
51?>
52--EXPECT--
53bd0 2010-11-07 01:00:00 EST America/New_York - 2010-11-07 01:59:59 EDT America/New_York = PT0H0M1S
54bd5 2010-11-07 01:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT22H
55bd6 2010-11-07 01:30:00 EDT America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT21H
56bd8 2010-11-07 01:30:00 EST America/New_York - 2010-11-06 01:30:00 EDT America/New_York = P1DT1H
57