Skip to content

Commit

Permalink
change code to use parsedatetime (closes #136)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraanzu committed Aug 1, 2023
1 parent a5b9d1c commit f1d66a9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions dooit/utils/date_parser.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import dateutil.parser
from datetime import datetime
from typing import Optional
import parsedatetime
from os import environ

DATE_ORDER = environ.get("DOOIT_DATE_ORDER", "DMY")
cal = parsedatetime.Calendar()


def parse(value: str):
def parse(value: str) -> Optional[datetime]:
if value == "none":
return None

return dateutil.parser.parse(value)
return cal.parseDT(value)[0]

0 comments on commit f1d66a9

Please sign in to comment.