KG
09/17/2025, 9:17 PMMarvin
09/17/2025, 9:17 PMMarvin
09/17/2025, 9:22 PMdate
but does not provide a proper datetime picker or reliably handle a date | datetime
union when starting a run. Under the hood, Prefect can validate/parse datetimes just fine; it’s the form control that’s limited.
Workarounds you can use today:
- Use the JSON editor in the run modal and pass an ISO 8601 string for your datetime. Prefect will parse it to a datetime
if your parameter is typed accordingly.
{
"as_of": "2025-09-17T12:30:00Z"
}
- If you want to avoid any UI validation quirks, declare the parameter as str
and parse inside your flow:
from datetime import datetime
from prefect import flow
@flow
def my_flow(as_of: str):
dt = datetime.fromisoformat(as_of.replace("Z", "+00:00"))
# use dt...
- If appropriate, use the flow’s scheduled start time instead of passing a datetime as a parameter (available in prefect.runtime.flow_run.scheduled_start_time
).
If you’re open to it, I can file an issue for better datetime support (and for handling date | datetime
unions) in the run modal. Also, could you share:
- The exact parameter annotation you’re using (e.g., date | datetime
), and
- Whether you were using the form fields or the JSON editor, plus any error text you saw?
That will help us reproduce and get a fix prioritized.KG
09/17/2025, 10:26 PM