- from, to = times.collect { |t| DateTime.parse(t) }
- return changesets.where("closed_at >= ? and created_at <= ?", from, to)
- else
- # if there is no comma, assume its a lower limit on time
- return changesets.where("closed_at >= ?", DateTime.parse(time))
- end
+ # check that we actually have 2 elements in the array
+ times = time.split(/,/)
+ raise OSM::APIBadUserInput, "bad time range" if times.size != 2
+
+ from, to = times.collect { |t| Time.parse(t) }
+ return changesets.where("closed_at >= ? and created_at <= ?", from, to)
+ else
+ # if there is no comma, assume its a lower limit on time
+ return changesets.where("closed_at >= ?", Time.parse(time))