Bug #73628 [Opn->Fbk]: DateTime not able to handle DateInterval on february

From: Date: Wed, 30 Nov 2016 16:46:15 +0000
Subject: Bug #73628 [Opn->Fbk]: DateTime not able to handle DateInterval on february
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205697@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73628&edit=1 ID: 73628 Updated by: cmb@php.net Reported by: etienne dot chabert at gmail dot com Summary: DateTime not able to handle DateInterval on february -Status: Open +Status: Feedback Type: Bug -Package: date_time +Package: Date/time related Operating System: OSX PHP Version: 7.0.13 Block user comment: N Private report: N New Comment: Please state what you expect both expressions to yield! Previous Comments: ------------------------------------------------------------------------ [2016-11-30 14:21:50] etienne dot chabert at gmail dot com Description: ------------ You should execute : (new DateTime("2016-11-30"))->add(new DateInterval("P3M")) Result -> 2017-03-02 Then execute : (new DateTime("2016-12-01"))->add(new DateInterval("P3M")) Result -> 2017-03-01 Test script: --------------- if ((new DateTime("2016-11-30"))->add(new DateInterval("P3M")) > (new DateTime("2016-12-01"))->add(new DateInterval("P3M"))) throw new Exception("WTF"); echo "You fixed it"; ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73628&edit=1

« previous php.bugs (#205697) next »