You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently investigating a potential issue with invalid dates not getting caught in this block
I have the following variables :
v = "2011-11-41"(an invalid date)
primitive_meta = {"type"=>"string", "regex"=>"-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1]))?)?"}
datatype = "date"
This condition(primitive_meta['regex'] && primitive_meta['type'] != 'number') returns true because primitive_meta['type'] is a string.
And (v =~ Regexp.new(primitive_meta['regex'])) returns 0 .
So on the following line match.nil? returns false meaning that the date is correct.
I don't exactly understand why we have checking for the number (type because this line FHIR::STU3.primitive?(datatype: datatype, value: v) would actually work.) so I don't really know what the best solution could be.
Thanks
The text was updated successfully, but these errors were encountered:
theonegri
changed the title
Invalid date note triggering an error
Invalid date not triggering an error
Dec 21, 2020
Hello.
I'm currently investigating a potential issue with invalid dates not getting caught in this block
I have the following variables :
v =
"2011-11-41"
(an invalid date)primitive_meta =
{"type"=>"string", "regex"=>"-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1]))?)?"}
datatype =
"date"
This condition(
primitive_meta['regex'] && primitive_meta['type'] != 'number'
) returns true becauseprimitive_meta['type']
is a string.And
(v =~ Regexp.new(primitive_meta['regex']))
returns 0 .So on the following line
match.nil?
returns false meaning that the date is correct.I don't exactly understand why we have checking for the
number
(type because this lineFHIR::STU3.primitive?(datatype: datatype, value: v)
would actually work.) so I don't really know what the best solution could be.Thanks
The text was updated successfully, but these errors were encountered: