303
304
305
306
307
308
309
310
311
312
313
314
|
# File 'lib/active_scaffold/finder.rb', line 303
def parse_time_with_format(value, format, offset)
format.gsub!(/%-d|%-m|%_m/) { |s| s.gsub(/[-_]/, '') } en_value = I18n.locale == :en ? value : translate_days_and_months(value, format)
time = Time.strptime(en_value, format)
offset ? time : Time.zone.local_to_utc(time).in_time_zone
rescue StandardError => e
message = "Error parsing time from #{en_value}"
message << " (#{value})" if en_value != value
message << ", with format #{format}" if format
Rails.logger.warn "#{message}:\n#{e.message}\n#{e.backtrace.join("\n")}"
nil
end
|