lib/saulabs/reportable/reporting_period.rb in reportable-1.1.2 vs lib/saulabs/reportable/reporting_period.rb in reportable-1.2.0

- old
+ new

@@ -68,10 +68,11 @@ # # @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) - parts = grouping.date_parts_from_db_string(db_string) + return self.new(grouping, db_string) if db_string.is_a?(Date) + 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 self.new(grouping, Date.new(parts[0], parts[1], parts[2]))