lib/saulabs/reportable/reporting_period.rb in reportable-1.2.0 vs lib/saulabs/reportable/reporting_period.rb in reportable-1.3.0
- old
+ new
@@ -68,10 +68,10 @@
#
# @return [Saulabs::Reportable::ReportingPeriod]
# the reporting period for the {Saulabs::Reportable::Grouping} as parsed from the db string
#
def self.from_db_string(grouping, db_string)
- return self.new(grouping, db_string) if db_string.is_a?(Date)
+ return self.new(grouping, db_string) if db_string.is_a?(Date) || db_string.is_a?(Time)
parts = grouping.date_parts_from_db_string(db_string.to_s)
case grouping.identifier
when :hour
self.new(grouping, DateTime.new(parts[0], parts[1], parts[2], parts[3], 0, 0))
when :day