[Fix #1475] Ensure date is parsable before doing it (to avoid errors)

This commit is contained in:
Mathieu Magnin 2018-02-26 12:01:28 +01:00
parent b8958add7a
commit 3db941ea06
2 changed files with 36 additions and 1 deletions

View file

@ -12,7 +12,8 @@ class Individual < ActiveRecord::Base
private
def set_iso_date
if birthdate.present?
if birthdate.present? &&
birthdate =~ /\A\d{2}\/\d{2}\/\d{4}\z/
self.birthdate = Date.parse(birthdate).iso8601
end
end