@@ -348,6 +348,13 @@ def _strip(value: str | None) -> str | None:
348348 stripped = value .strip ()
349349 return stripped or None
350350
351+ @staticmethod
352+ def _parse_optional_date (value : str | None ) -> date | None :
353+ stripped = AffiliationService ._strip (value )
354+ if not stripped :
355+ return None
356+ return date .fromisoformat (stripped )
357+
351358 @classmethod
352359 def group_parse_rows (
353360 cls , rows : list [AffiliationParseRow ]
@@ -384,8 +391,8 @@ def group_parse_rows(
384391 stint = AffiliationOrganizationStint (
385392 name = "Individual" ,
386393 domain = "individual-noaccount.com" ,
387- date_start = organization .date_start ,
388- date_end = organization .date_end ,
394+ date_start = cls . _parse_optional_date ( organization .date_start ) ,
395+ date_end = cls . _parse_optional_date ( organization .date_end ) ,
389396 is_unaffiliated = True ,
390397 )
391398 elif not domain :
@@ -394,8 +401,8 @@ def group_parse_rows(
394401 stint = AffiliationOrganizationStint (
395402 name = cls ._strip (organization .name ),
396403 domain = domain .lower (),
397- date_start = organization .date_start ,
398- date_end = organization .date_end ,
404+ date_start = cls . _parse_optional_date ( organization .date_start ) ,
405+ date_end = cls . _parse_optional_date ( organization .date_end ) ,
399406 is_unaffiliated = False ,
400407 )
401408
0 commit comments