Subtracting two DateTimes to return a Duration?

38 views
Skip to first unread message

David Faulkenberry

unread,
Dec 13, 2016, 6:05:21 PM12/13/16
to Ruby on Rails: Core
This was spurred by my desire to be able to write in RSpec something like:

expect(a_datetime).to be_within 5.minutes of some_other_datetime

All that would be needed to make this and other such comparisons work (as far as I can tell) is to implement the 'minus' method such that subtracting two DateTimes returns a Duration.

Seems like it might make a nice addition.

David Faulkenberry

unread,
Dec 22, 2016, 9:49:37 AM12/22/16
to Ruby on Rails: Core

Opened #27436 for comment.

Reply all
Reply to author
Forward
0 new messages