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

Adding duration to time #32

Open
sandstrom opened this issue May 30, 2016 · 0 comments
Open

Adding duration to time #32

sandstrom opened this issue May 30, 2016 · 0 comments

Comments

@sandstrom
Copy link

sandstrom commented May 30, 2016

Would be great if one could add a duration to time, yielding a new time instance.

Time.now + Duration.new(:days => 1) #=> time_at_one_day_from_now

Ruby's coerce should also be helpful here, so that the ordering doesn't matter:


# Similarly, I would expect
Duration.new(:days => 2) + Time.now === Time.now.advance(:days => 2)

# Currently this is instead:
Duration.new(:days => 2) + Time.now # => seconds since 1970 + 2 days (as `Duration`)

# While this is one possible interpretation It's fairy non-sensical, 
# i.e. it's not very useful, while a result that returned a new time instance 
# would make durations much more useable!
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

2 participants