lib/weather-api/utils.rb in weather-api-1.0.0 vs lib/weather-api/utils.rb in weather-api-1.0.1

- old
+ new

@@ -4,10 +4,14 @@ class Utils # Attempts to convert passed text into a Time object # # Returns a Time object or nil - def self.parse_time(text) + def self.parse_time(text = '') + if text == '' + return nil + end + begin Time.parse(text) rescue ArgumentError Chronic.parse(text) end