Module: Cleaners::EndOfDay
- Defined in:
- lib/data_cleansing/cleaners.rb
Overview
Convert a Date to a Time at the end of day for that date (YYYY-MM-DD 23:59:59) Ex: 2015-12-31 becomes 2015-12-31 23:59:59 If something other than a Date object is passed in, it just passes through.
Note: Only works if ActiveSupport is also loaded since it defines Time#end_of_day.
Class Method Summary collapse
Class Method Details
.call(datetime) ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/data_cleansing/cleaners.rb', line 166 def self.call(datetime) case datetime when String Time.parse(datetime).end_of_day when Date datetime.to_time.end_of_day when Time datetime.end_of_day else datetime end end |