Re: timelib diff working wrong on with years
| From: | Derick Rethans | Date: | Wed, 11 Dec 2013 12:50:31 +0000 |
| Subject: | Re: timelib diff working wrong on with years | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70590@lists.php.net to get a copy of this message | ||
On Wed, 11 Dec 2013, Nikita Nefedov wrote:
> On Wed, 11 Dec 2013 14:13:07 +0400, Derick Rethans <derick@php.net> wrote:
>
> > On Wed, 11 Dec 2013, Nikita Nefedov wrote:
> >
> > > today I stumbled upon this bug, but I actually don't know should I
> > > call it bug or is it right behavior?
> > >
> > > So for example lets get diff between 2013-10-25 and 2014-10-25:
> > > var_dump((new DateTime("2013-03-25"))->diff(new
> > > DateTime("2014-03-25")))
> > >
> > > We'll get one full year.
> > >
> > > Then if we try to get diff between 2012-03-25 and 2013-03-25 we'll
> > > also get one year.
> > >
> > > But if we have 2012-03-01 and 2013-03-01 then we get 11 months and
> > > 30 days (365 in int->days member)...
> > >
> > > Should we consider this as a bug or not?
> >
> > I did some fixes for this already - which version of PHP is this?
>
> I can reproduce this on 5.5.7RC1 tag. (can't check it on the other
> versions at the moment)
Please file a bug. I'll try to get at it at the weekend (don't you love
christmas hacking time!)
cheers,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine