Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

1.5.days.ago != 36.hours.ago

#970

1.5.days.ago != 36.hours.ago in 2.1... this worked in 1.2.3, and was a little surprising when migrating an exiting site.

I've attached a patch to fix this, by waterfalling the fractional weeks and days down to hours.

This does not change the way months and years behave, but it may be worth looking a being a little more grumpy about calling .years or .months on a float... but I digress...

Patch attached, as always, feedback/comments/+1s all welcome.

Reported by Tom Lea · September 4th, 2008 @ 05:53 PM

State: resolved
Milestone: none
Assigned to: Geoff Buesing Geoff Buesing
Importance: none

Activity

  1. Tom Lea
    Tom Lea
    • Tag changed from activesupport, core_ext, patch to activesupport, bug, core_ext, patch

    Updated the patch with input from rails-core.

    Deprecated Float#years and Float#months.

    September 11th, 2008 @ 04:46 PM

  2. Michael Koziarski
    Michael Koziarski
    • Milestone cleared.
    • Assigned user set to Geoff Buesing

    September 11th, 2008 @ 05:04 PM

  3. Geoff Buesing
    Geoff Buesing

    Failing test with this latest patch :/

    1) Error: test_deprecated_fractional_months(DurationTest): ArgumentError: wrong number of arguments (3 for 2)

    September 15th, 2008 @ 01:03 AM

  4. Tom Lea
    Tom Lea

    Gah!

    It seems something I was toying with (and clearly did not have time to get finished) slipped into a commit.

    Updated patch attached to finish what I was toying with... feel free to squash the commits down if you prefer.

    September 16th, 2008 @ 09:22 AM

  5. Repository
    Repository
    • State changed from new to resolved

    (from [27c70ff386e76ed0af41b53f2ba8cdb09bc94ace]) Time#advance recognizes fractional days and weeks [#970 1.5.days.ago != 36.hours.ago state:resolved] http://github.com/rails/rails/co...

    October 14th, 2008 @ 02:27 AM

  6. Tom Lea
    Tom Lea
    • Tag changed from activesupport, bug, core_ext, patch to activesupport, bug, core_ext, patch

    Thanks for the commit Geoff.

    October 14th, 2008 @ 05:34 PM