Skip to content

Commit

Permalink
fix: ensure data is proper format for conversion method
Browse files Browse the repository at this point in the history
  • Loading branch information
EPortman committed Sep 25, 2024
1 parent 2b76a53 commit 0eacd53
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions colin-api/src/colin_api/models/filing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1297,10 +1297,17 @@ def add_filing(cls, con, filing: Filing) -> int:
@classmethod
def _get_last_ar_filed_date(cls, header: dict, business: dict):
filing_year = header.get('filingYear')
pacific_founding_date = convert_to_pacific_time(
datetime.datetime.fromisoformat(business['business']['foundingDate'])
founding_date_str = business['business']['foundingDate']

# If the founding date has `-00:00`, replace it with `+00:00` before passing to the function
if '-00:00' in founding_date_str:
founding_date_str = founding_date_str.replace('-00:00', '+00:00')

pacific_founding_date = datetime.datetime.fromisoformat(
convert_to_pacific_time(founding_date_str)
).date()
last_ar_filed_dt = f'{filing_year}-{pacific_founding_date.month}-{pacific_founding_date.day}'

last_ar_filed_dt = f'{filing_year}-{pacific_founding_date.month:02}-{pacific_founding_date.day:02}'
return last_ar_filed_dt

@classmethod
Expand Down

0 comments on commit 0eacd53

Please sign in to comment.