Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time.diff gives wrong answer for February in leap years #2

Open
alikhajeh1 opened this issue Feb 2, 2012 · 3 comments
Open

Time.diff gives wrong answer for February in leap years #2

alikhajeh1 opened this issue Feb 2, 2012 · 3 comments

Comments

@alikhajeh1
Copy link

Time.diff(Time.new(2012, 03, 01), Time.new(2012, 02, 01))
=> {:year=>0, :month=>0, :week=>4, :day=>1, :hour=>0, :minute=>0, :second=>0, :diff=>"4 weeks, 1 day and 00:00:00"}

So it shows the time diff as 4 weeks and 1 days between February and March, but this should be returning 1 month.

@abhidsm
Copy link
Owner

abhidsm commented Feb 4, 2012

Hi Ali,
Thanks for reporting this issue. I will fix this soon.

@joshmvandercom
Copy link

Any updates to this?

@kry00la
Copy link

kry00la commented Apr 17, 2012

+1

henrycatalinismith added a commit to henrycatalinismith/ppl that referenced this issue Jan 6, 2022
Incidentally, Ruby appears to lack an equivalent to PHP's DateInterval class.
There's time_diff, but that's been broken for over a year
(abhidsm/time_diff#2). In the end I gave up and went
with a code snippet from Stack Overflow, which is the sort of programming
practice that I despise. Ruby's "optimisation for programmer happiness" isn't
look quite so optimal right now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants