refactor: use single date.today() call in get_default_date_range
Avoids potential midnight inconsistency between start and end of the fallback period. Related to #50.
This commit is contained in:
@@ -370,7 +370,8 @@ class Config:
|
||||
def get_default_date_range(cls) -> str:
|
||||
from_env = os.getenv("DEFAULT_FROM_DATE", "").strip()
|
||||
to_env = os.getenv("DEFAULT_TO_DATE", "").strip()
|
||||
today_str = date.today().isoformat()
|
||||
today = date.today()
|
||||
today_str = today.isoformat()
|
||||
|
||||
if from_env:
|
||||
return f"{from_env}--{to_env or today_str}"
|
||||
@@ -392,7 +393,7 @@ class Config:
|
||||
default_to = cls._app.period_default_to or today_str
|
||||
return f"{cls._app.period_default_from}--{default_to}"
|
||||
|
||||
start = date.today().replace(day=1)
|
||||
start = today.replace(day=1)
|
||||
return f"{start.isoformat()}--{today_str}"
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user