Hi, Just arrived. I have registered a flow and hav...
# prefect-community
Hi, Just arrived. I have registered a flow and have added the CronSchedule. It gets scheduled on the right time but it is picking up the wrong date
Copy code
flow.schedule = CronSchedule("49 21 * * 1-5",start_date=pendulum.datetime(2022, 1, 1, tz="Asia/Kolkata"),)

What could be the reason for this?
What date is it picking up for you?
So I had registered the flow yesterday and yesterday it worked fine
But today it is picking up the yesterday's date only
Is that related to your schedule or do you have a date Parameter in your flow?
Copy code
# -- Write you flows here
  with Flow(workflow_name) as flow:
    today_date = datetime.datetime.now(pytz.timezone('Asia/Kolkata')).strftime("%Y%m%d")
    date = Parameter("date", default=today_date
Yeah exactly. That date is fixed during the registration time. You need to make it a task so that it’s evaluated during runtime.
Copy code
def get_date(val):
    if val == None:
        return datetime.datetime.now(pytz.timezone('Asia/Kolkata')).strftime("%Y%m%d")

with Flow(...) as flow:
    the_date = Parameter("today", default=None)
    the_date = get_date(the_date)
Thanks Kevin - let me try this and get back
The issue is the default is evaluated immediately during registration