diff options
-rw-r--r-- | lesana/types.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lesana/types.py b/lesana/types.py index 1d5322e..0b278d6 100644 --- a/lesana/types.py +++ b/lesana/types.py @@ -226,9 +226,11 @@ class LesanaDate(LesanaType): return data if isinstance(data, datetime.date): return data + # compatibility with dateutil before 2.8 + ParserError = getattr(dateutil.parser, 'ParserError', ValueError) try: return dateutil.parser.parse(data) - except dateutil.parser.ParserError: + except ParserError: raise LesanaValueError( "Invalid value for date field: {}".format(data) ) |