https://prefect.io logo
Title
s

Sharvil Popli

09/15/2022, 3:04 PM
Hi All, I am trying to implement a date parameter in prefect UI like so
start_date = Parameter("start_date", default="2022-09-11")
What I see on the UI after registering the flow is in the first attached image. start_date shows up as string. What I’d like to see by default is in the second image, I’d like start_date to show up as date type instead of as string with the date time picker functionality. How can I achieve this?
1️⃣ 1
c

Christopher Boyd

09/15/2022, 8:50 PM
HI Sharvil, have you looked at https://docs-v1.prefect.io/api/latest/utilities/context.html#context-2? There is variable:
scheduled_start_time	a datetime object representing the scheduled start time for the flow run; falls back to now for unscheduled runs
s

Sharvil Popli

09/16/2022, 12:06 AM
Hi Christopher, I don’t see any good examples in the doc to set Parameter to date type. How can context help with this, could you provide a code example?
all good now, this worked for me
start_date = Parameter("start_date", default="2012-04-23T18:25:43.511Z")
🙌 1