Skip to content

Commit c6313df

Browse files
committed
testing all fields
1 parent 4446d87 commit c6313df

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

backend/src/models/utils/pre_validator_utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def for_date(field_value: str, field_location: str, future_date_allowed: bool =
9898
f'{field_location} must be a valid date string in the format "YYYY-MM-DD"'
9999
) from value_error
100100

101-
# Enforce not-in-the-future rule using central checker (after successful parse)
101+
# Enforce future date rule using central checker after successful parse
102102
if not future_date_allowed and PreValidation.check_if_future_date(parsed_date):
103103
raise ValueError(f"{field_location} must not be in the future")
104104

@@ -140,7 +140,7 @@ def for_date_time(field_value: str, field_location: str, strict_timezone: bool =
140140
for fmt in formats:
141141
try:
142142
fhir_date = datetime.strptime(field_value, fmt)
143-
# Enforce future-date rule using central checker (after successful parse)
143+
# Enforce future-date rule using central checker after successful parse
144144
if PreValidation.check_if_future_date(fhir_date):
145145
raise ValueError(f"{field_location} must not be in the future")
146146
# After successful parse, enforce timezone and future-date rules
@@ -255,4 +255,5 @@ def check_if_future_date(parsed_value: date | datetime):
255255
elif isinstance(parsed_value, date):
256256
now = datetime.now().date()
257257
if parsed_value > now:
258-
return True
258+
return True
259+
return False

backend/tests/utils/values_for_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ValidValues:
3434
for_date_times_strict_timezones = [
3535
"2000-01-01", # Full date only
3636
"2000-01-01T00:00:00+00:00", # Time and offset all zeroes
37-
"2025-05-20T18:26:30+01:00", # Date with Time with no milliseconds and positive offset
37+
"2025-09-24T11:04:30+01:00", # Date with Time with no milliseconds and positive offset
3838
"2000-01-01T00:00:00+01:00", # Time and offset all zeroes
3939
"1933-12-31T11:11:11+01:00", # Positive offset (with hours and minutes not 0)
4040
"1933-12-31T11:11:11.1+00:00", # DateTime with milliseconds to 1 decimal place

0 commit comments

Comments
 (0)