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

Version Path
facets-1.0.0 lib/facet/time/self/days_extrema.rb
facets-1.0.3 packages/core/lib/facet/time/self/days_extrema.rb
facets-0.9.0 lib/nano/time/self/days_extrema.rb
facets-1.2.0 lib/facets/core/time/self/days_extrema.rb
facets-1.2.1 lib/facets/core/time/self/days_extrema.rb
facets-1.3.0 lib/facets/core/time/self/days_extrema.rb
facets-1.1.0 lib/facet/time/self/days_extrema.rb
facets-1.3.3 lib/facets/core/time/self/days_extrema.rb
facets-1.3.1 lib/facets/core/time/self/days_extrema.rb
facets-1.3.2 lib/facets/core/time/self/days_extrema.rb
facets-1.4.1 lib/facets/core/time/self/days_extrema.rb
facets-1.4.2 lib/facets/core/time/self/days_extrema.rb
facets-1.4.0 lib/facets/core/time/self/days_extrema.rb
facets-1.4.3 lib/facets/core/time/self/days_extrema.rb
facets-1.4.5 lib/facets/core/time/self/days_extrema.rb
facets-1.4.4 lib/facets/core/time/self/days_extrema.rb
facets-1.7.30 lib/facets/core/time/self/days_extrema.rb
facets-1.7.0 lib/facets/core/time/self/days_extrema.rb
facets-1.7.38 lib/facets/core/time/self/days_extrema.rb
facets-1.7.46 lib/facets/core/time/self/days_extrema.rb