update code, switch to loguru

This commit is contained in:
2025-01-10 09:35:18 +01:00
parent e915b47dda
commit 0d7dc28876
17 changed files with 127 additions and 162 deletions

View File

@@ -1,6 +1,6 @@
# import qdate
from PyQt6 import QtCore
from .debug import debugMessage
from src import log
def stringToDate(date: str) -> QtCore.QDate:
"""Takes an input string and returns a QDate object.
@@ -10,7 +10,7 @@ def stringToDate(date: str) -> QtCore.QDate:
Returns:
QtCore.QDate: the QDate object in string format DD.MM.yyyy
"""
debugMessage(date=date)
log.debug(f"stringToDate: {date}")
if not date:
return ""
if isinstance(date, QtCore.QDate):
@@ -21,22 +21,3 @@ def stringToDate(date: str) -> QtCore.QDate:
month = datedata[1]
year = datedata[0]
return QtCore.QDate(int(year), int(month), int(day))
# else:
# datedata = date.split(" ")[1:]
# month = datedata[0]
# day = datedata[1]
# year = datedata[2]
# month = month.replace("Jan", "01")
# month = month.replace("Feb", "02")
# month = month.replace("Mar", "03")
# month = month.replace("Apr", "04")
# month = month.replace("May", "05")
# month = month.replace("Jun", "06")
# month = month.replace("Jul", "07")
# month = month.replace("Aug", "08")
# month = month.replace("Sep", "09")
# month = month.replace("Oct", "10")
# month = month.replace("Nov", "11")
# month = month.replace("Dec", "12")
# return QtCore.QDate(int(year), int(month), int(day)).toString("dd.MM.yyyy")