only show events for 1 hour for economic calendar

This commit is contained in:
Justin 2023-06-16 22:37:20 +08:00 committed by GitHub
parent e1572cdcd7
commit 73bfbf5ece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -725,9 +725,9 @@ def updateEconomic(api_key, logf):
country_codes_list = [country_codes[c] for c in country]
result = ",".join(country_codes_list)
timezone = pytz.timezone(all_economic_settings['timezone'])
# date_local = datetime.now(timezone)
# date_local = (date_local - timedelta(hours=1)).strftime('%Y-%m-%dT%H:%M:00')
date_local = datetime.now(timezone).strftime('%Y-%m-%dT00:00:00')
date_local = datetime.now(timezone)
date_local = (date_local - timedelta(hours=1)).strftime('%Y-%m-%dT%H:%M:00')
#date_local = datetime.now(timezone).strftime('%Y-%m-%dT00:00:00')
date_local2 = datetime.now(timezone).strftime('%Y-%m-%dT23:59:00')
date_from = timezone.localize(datetime.strptime(date_local,'%Y-%m-%dT%H:%M:%S')).astimezone(pytz.timezone('GMT')).strftime('%Y-%m-%dT%H:%M:%S.000Z')
date_to = timezone.localize(datetime.strptime(date_local2,'%Y-%m-%dT%H:%M:%S')).astimezone(pytz.timezone('GMT')).strftime('%Y-%m-%dT%H:%M:%S.000Z')