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

DateTime End of X does not match Time/Ruby1.9+ usec #21424

Closed
toobulkeh opened this issue Aug 29, 2015 · 1 comment
Closed

DateTime End of X does not match Time/Ruby1.9+ usec #21424

toobulkeh opened this issue Aug 29, 2015 · 1 comment

Comments

@toobulkeh
Copy link

Noticed this inconsistency when doing some time work today:

pry(main)> DateTime.now.end_of_day
=> Fri, 28 Aug 2015 23:59:59 -0400
pry(main)> DateTime.now.end_of_day.usec
=> 0
pry(main)> Time.now.end_of_day
=> 2015-08-28 23:59:59 -0400
pry(main)> Time.now.end_of_day.usec
=> 999999
pry(main)> Date.today.end_of_day
=> Fri, 28 Aug 2015 23:59:59 UTC +00:00
pry(main)> Date.today.end_of_day.usec
=> 999999

After reading through the code, it looks like this is true for all end_of helper functions here

Is there a point for this inconsistency, or should I submit a PR/CHANGELOG?

@rails-bot
Copy link

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 team are limited, and so we are asking for your help.

If you can still reproduce this error on the 4-2-stable, 4-1-stable branches or on master,
please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions.

pixeltrix added a commit that referenced this issue Mar 1, 2017
Adding support for these options now allows us to update the
`DateTime#end_of` methods to match the equivalent `Time#end_of`
methods, e.g:

    datetime = DateTime.now.end_of_day
    datetime.nsec == 999999999 # => true

Fixes #21424.
pixeltrix added a commit that referenced this issue Mar 2, 2017
Adding support for these options now allows us to update the
`DateTime#end_of` methods to match the equivalent `Time#end_of`
methods, e.g:

    datetime = DateTime.now.end_of_day
    datetime.nsec == 999999999 # => true

Fixes #21424.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants