Sha256: f9778a1de3d73ac2185218c640d9d84f97426d0868720893b4390fd818155981
Contents?: true
Size: 639 Bytes
Versions: 28
Compression:
Stored size: 639 Bytes
Contents
# This method calculates the days extrema given two time objects. # start time is the given time1 at 00:00:00 # end time is the given time2 at 23:59:59:999 # # Input: # - the two times (if only time1 is provided then you get an extrema # of exactly one day extrema. # # Output: # - the time range. you can get the start/end times using # range methods. # #-- # Credit goes to George Moschovitis #++ def Time.days_extrema(time1, time2=nil) time2 = time1 if (not time2.valid? Time) time2 = NEVER if (time2 <= time1) start_time = Time.self.start_of_day(time1) end_time = self.end_of_day(time2) return (start_time..end_time) end
Version data entries
28 entries across 28 versions & 2 rubygems