Skip to content

Commit

Permalink
If a date from the database is unparseable, use the raw string
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonj04 committed Apr 21, 2023
1 parent 6c6126d commit d7b6ed3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion judgments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from caselawclient.Client import api_client
from dateutil import parser as dateparser
from dateutil.parser import ParserError
from django.db import models
from djxml import xmlmodels
from ds_caselaw_utils.courts import CourtNotFoundException, courts
Expand All @@ -25,7 +26,11 @@ def __init__(
self.uri = uri
self.neutral_citation = neutral_citation
self.name = name
self.date = dateparser.parse(date)

try:
self.date = dateparser.parse(date)
except ParserError:
self.date = date
try:
self.court = courts.get_by_code(court)
except CourtNotFoundException:
Expand Down

0 comments on commit d7b6ed3

Please sign in to comment.