Bug->Req #70381 [Opn]: Support comparing DateInterval objects
| From: | requinix@php.net | Date: | Fri, 28 Aug 2015 11:45:44 +0000 |
| Subject: | Bug->Req #70381 [Opn]: Support comparing DateInterval objects | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-195590@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70381&edit=1
ID: 70381
Updated by: requinix@php.net
Reported by: accido at ukr dot net
-Summary: DateInterval comparsion wrong
+Summary: Support comparing DateInterval objects
Status: Open
-Type: Bug
+Type: Feature/Change Request
Package: Date/time related
Operating System: Xubuntu 14
PHP Version: 5.6.13RC1
Block user comment: N
Private report: N
New Comment:
DateIntervals are not comparable. You can use ->days as a workaround.
https://3v4l.org/H7JsN
Previous Comments:
------------------------------------------------------------------------
[2015-08-28 10:48:17] accido at ukr dot net
Description:
------------
Wrong DateInterval comparsion result
Test script:
---------------
$a = new DateTime('1981-10-10');
$b = new DateTime('1980-10-01');
$m = new DateInterval('P1M');
var_dump($a->diff($b) > $m);
//bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70381&edit=1