Improve parse_literal
@@ -21,14 +21,15 @@ def serialize(date):
def parse_literal(ast):
- if isinstance(ast, StringValue):
+ if not isinstance(ast, StringValue):
+ return None
+
formatted_date = ast.value
try:
parsed_datetime = datetime.strptime(formatted_date, "%Y-%m-%d")
return parsed_datetime.date()
except ValueError:
pass
- return None
def parse_value(formatted_date):
