Sha256: e7cad3b67ef95a8e7c8bfb59d7ed53795828657441a9e7da7bdc900c9bf68a1a
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
class Date include ErrorHelper def self.build_date_array(start_date, end_date) start_date = start_date.to_date end_date = end_date.to_date raise_start_date_before_end_date if (start_date > end_date) date_array = [] processable_date = start_date.dup while processable_date <= end_date date_array << processable_date processable_date = processable_date.tomorrow end date_array end def self.range(start, _end) start.to_date.beginning_of_day.._end.to_date.end_of_day end def build_date_array(date) date = date.to_date if self < date start_date = self end_date = date else start_date = date end_date = self end return Date.build_date_array(start_date, end_date) end def array_with_pre_churn_limit(count_of_additional_days) explicit_limit_date = (self + count_of_additional_days.days) now = Time.zone.now.to_date cutoff_date = (explicit_limit_date > now ? now.yesterday : explicit_limit_date) return Date.build_date_array(self, cutoff_date) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
creative_rails_utilities-0.4.8 | lib/creative_rails_utilities/date.rb |