facebook / facebook/hhvm

DateInterval around DST incompatible with PHP

Open
#7,543 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

### HHVM Version
hhvm-3.12.0 - 3.13.2
Test at: https://3v4l.org/LCvJD

### Standalone code, or other way to reproduce the problem
DST changes on last sunday of october 03:00 => 02:00

```php
// interval one day. Counts days
$dateTime = new DateTime('2016-10-29 10:00:00');
$dateTime->add(new DateInterval('P1D'));
print_r($dateTime); // 2016-10-30 10:00

// interval 24 hours. PHP counts hours, HHVM counts days ?
$dateTime = new DateTime('2016-10-29 10:00:00');
$dateTime->add(new DateInterval('PT24H'));
print_r($dateTime); // 2016-10-30 09:00
```

### Expected result
```
// Output for PHP 5.6.0 - 5.6.29, 7.0.0 - 7.1.0
DateTime Object
(
[date] => 2016-10-30 10:00:00.000000
[timezone_type] => 3
[timezone] => Europe/Amsterdam
)
DateTime Object
(
[date] => 2016-10-30 09:00:00.000000
[timezone_type] => 3
[timezone] => Europe/Amsterdam
)}
```

### Actual result
```
// Output for hhvm-3.12.0 - 3.13.2
DateTime Object
(
[date] => 2016-10-30 10:00:00.000000
[timezone_type] => 3
[timezone] => Europe/Amsterdam
)
DateTime Object
(
[date] => 2016-10-30 10:00:00.000000
[timezone_type] => 3
[timezone] => Europe/Amsterdam
)
```

issue found via http://www.mendoweb.be/blog/php-dateinterval-dst-change/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.