Method: PostHog::Utils#convert_to_datetime
- Defined in:
- lib/posthog/utils.rb
#convert_to_datetime(value) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/posthog/utils.rb', line 90 def convert_to_datetime(value) if value.respond_to?(:strftime) parsed_date = value return parsed_date elsif value.respond_to?(:to_str) begin parsed_date = DateTime.parse(value) return parsed_date rescue ArgumentError => e raise InconclusiveMatchError.new("#{value} is not in a valid date format") end else raise InconclusiveMatchError.new("The date provided must be a string or date object") end end |