app/models/imports/validations.rb in artfully_ose-1.2.0 vs app/models/imports/validations.rb in artfully_ose-1.3.0.pre1
- old
+ new
@@ -14,9 +14,16 @@
begin
DateTime.parse(date_str)
rescue
raise Import::RowError, "Invalid date: #{date_str} Make sure the date is in the format YEAR/MONTH/DAY (2012/04/18) or DAY-MONTH-YEAR (18-Apr-12)."
end
+
+ parsed_date = DateTime.parse(date_str)
+
+ if(parsed_date.year < 1900)
+ raise Import::RowError, "Invalid date: #{date_str} Make sure the date is in the format YEAR/MONTH/DAY (2012/04/18) or DAY-MONTH-YEAR (18-Apr-12)."
+ end
+
true
end
#
# Amount should be a string. Will throw a RowError unless amount_str is all numeric with one dot and two digits after the dot
\ No newline at end of file