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.

distance_of_time_in_words should work with DateTime as argument

#4919

distance_of_time_in_words should work with DateTime as argument

due to this bug: #1713 DateTime#to_time should always return a Time

since the rationale is in fraction of days and not in seconds!

simple solution attached.

Reported by yannick · June 21st, 2010 @ 11:07 AM

State: stale
Milestone: 3.x
Assigned to: Dan Pickett Dan Pickett
Importance: Low

Activity

  1. Bruno Michel
    Bruno Michel

    I don't see the problem on distance_of_time_in_words. Can you add a test in your patch to show it?

    June 29th, 2010 @ 09:56 PM

  2. yannick
    yannick

    i think it is clear, that if the calculation unit changes it will not work as expected. Time is in seconds, DateTime in days.

    if DateTime.to_time does not return a time result you get unexpected behaviour.

    thus, if #1713 DateTime#to_time should always return a Time is a wontfix you get inconsistent behavior until you make sure the calculation unit is as expected.

    July 8th, 2010 @ 03:38 PM

  3. rails
    rails
    • State changed from new to open

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    March 5th, 2011 @ 12:00 AM

  4. rails
    rails
    • State changed from open to stale

    March 5th, 2011 @ 12:00 AM

  5. Dan Pickett
    Dan Pickett
    • Tag changed from datetime time date to datetime, distance_of_time_in_words
    • Milestone set to 3.x
    • Assigned user set to Dan Pickett
    • Importance changed from to Low

    applying this patch causes 3 test failures in actionpack master. Can you fix the patch to include a failing test case without your change and fixes to remedy the test failures?

    March 13th, 2011 @ 05:27 PM