se agregoel cambio para que al ejecutar un dia lunes, la fecha de extraccion de datos sea el viernes anterior
This commit is contained in:
1 parent
83f704c85d
commit
7470cfd9b8
1 file changed
+6
-3
@@ -106,11 +106,14 @@ def get_report_dates():
|
||||
Retorna objetos System.DateTime compatibles con Crystal Reports.
|
||||
"""
|
||||
now = datetime.now(timezone.utc)
|
||||
yesterday = now - timedelta(days=1)
|
||||
# Si hoy es lunes (weekday() == 0), retroceder al viernes anterior (3 días atrás)
|
||||
days_back = 3 if now.weekday() == 0 else 1
|
||||
|
||||
previous_business_day = now - timedelta(days=days_back)
|
||||
|
||||
# Objetos .NET DateTime
|
||||
dt_yesterday = DateTime(yesterday.year, yesterday.month, yesterday.day)
|
||||
dt_month_start = DateTime(yesterday.year, yesterday.month, 1)
|
||||
dt_yesterday = DateTime(previous_business_day.year, previous_business_day.month, previous_business_day.day)
|
||||
dt_month_start = DateTime(previous_business_day.year, previous_business_day.month, 1)
|
||||
|
||||
return dt_month_start, dt_yesterday
|
||||
|
||||
|
||||
Reference in new issue
Block a user