diff --git a/setup.cfg b/setup.cfg index c13da1a..7621294 100644 --- a/setup.cfg +++ b/setup.cfg @@ -43,6 +43,7 @@ install_requires = openpyxl>=3.1.2,<4.0 xlrd>=2.0.1,<3.0 beangulp @ git+https://github.com/beancount/beangulp.git@master + python-dateutil>=2.9.0 [options.packages.find] diff --git a/src/uabean/importers/alfa_business.py b/src/uabean/importers/alfa_business.py index 0b234c0..6041a47 100755 --- a/src/uabean/importers/alfa_business.py +++ b/src/uabean/importers/alfa_business.py @@ -11,7 +11,7 @@ import beangulp from beancount.core import data, flags from beancount.core.number import D -from beancount.utils.date_utils import parse_date_liberally +from dateutil.parser import parse as parse_date from uabean.importers.mixins import IdentifyMixin @@ -45,7 +45,7 @@ def get_csv_dict_rows(self, filename): return list(csv.DictReader(f, delimiter=";")) def get_date_from_row(self, row): - return parse_date_liberally(row[self.DATE_FIELD], dict(dayfirst=True)) + return parse_date(row[self.DATE_FIELD], dayfirst=True).date() def get_account_from_row(self, row): k = (row["Валюта"], row["Наш IBAN"]) diff --git a/src/uabean/importers/nexo.py b/src/uabean/importers/nexo.py index c5eb7bd..ad50eb1 100755 --- a/src/uabean/importers/nexo.py +++ b/src/uabean/importers/nexo.py @@ -10,7 +10,7 @@ from beancount.core import data, flags from beancount.core.amount import Amount from beancount.core.number import D -from beancount.utils.date_utils import parse_date_liberally +from dateutil.parser import parse as parse_date from uabean.importers.mixins import IdentifyMixin @@ -30,7 +30,7 @@ def get_csv_reader(self, filename): return csv.DictReader(open(filename)) def get_date_from_row(self, row): - return parse_date_liberally(row["Date / Time"]) + return parse_date(row["Date / Time"]).date() def account(self, _): return "nexo" diff --git a/src/uabean/importers/procredit_business.py b/src/uabean/importers/procredit_business.py index 91783af..6f1375e 100755 --- a/src/uabean/importers/procredit_business.py +++ b/src/uabean/importers/procredit_business.py @@ -12,7 +12,7 @@ import beangulp from beancount.core import data, flags from beancount.core.number import D -from beancount.utils.date_utils import parse_date_liberally +from dateutil.parser import parse as parse_date from uabean.importers.mixins import IdentifyMixin @@ -35,7 +35,7 @@ def get_csv_reader(self, filename): return csv.DictReader(open(filename, encoding="windows-1251"), delimiter=";") def get_date_from_row(self, row): - return parse_date_liberally(row[self.DATE_FIELD], dict(dayfirst=True)) + return parse_date(row[self.DATE_FIELD], dayfirst=True).date() def get_account_from_row(self, row): k = (row["Валюта"], row["Рахунок"]) diff --git a/src/uabean/importers/tronscan.py b/src/uabean/importers/tronscan.py index d48c881..839116d 100755 --- a/src/uabean/importers/tronscan.py +++ b/src/uabean/importers/tronscan.py @@ -10,7 +10,7 @@ from beancount.core import data, flags from beancount.core.amount import Amount from beancount.core.number import D -from beancount.utils.date_utils import parse_date_liberally +from dateutil.parser import parse as parse_date from uabean.importers.mixins import IdentifyMixin @@ -30,7 +30,7 @@ def get_csv_reader(self, filename): return csv.DictReader(open(filename)) def get_date_from_row(self, row): - return parse_date_liberally(row["block_ts"]) + return parse_date(row["block_ts"]).date() def account(self, _): return "tron" diff --git a/src/uabean/importers/ukrsib_business.py b/src/uabean/importers/ukrsib_business.py index 2779da2..f519479 100755 --- a/src/uabean/importers/ukrsib_business.py +++ b/src/uabean/importers/ukrsib_business.py @@ -11,7 +11,7 @@ import beangulp from beancount.core import data, flags from beancount.core.number import D -from beancount.utils.date_utils import parse_date_liberally +from dateutil.parser import parse as parse_date from uabean.importers.mixins import IdentifyMixin @@ -34,7 +34,7 @@ def get_csv_reader(self, filename): return csv.DictReader(open(filename, encoding="windows-1251"), delimiter=";") def get_date_from_row(self, row): - return parse_date_liberally(row[self.DATE_FIELD], dict(dayfirst=True)) + return parse_date(row[self.DATE_FIELD], dayfirst=True).date() def get_account_from_row(self, row): k = (row["Валюта"], row["Рахунок"])