<@ULVA73B9P> is there any reason that I can supply...
# marvin-ai
k
@Marvin is there any reason that I can supply a date type parameter to a flow run when kicking it off from the UI in Cloud UI, but not a datetime parameter even though the argument when defined at the flow has type check for either date or datetime?
m
thought for 302.0 seconds
Short answer: this is a UI limitation, not a Prefect engine limitation. - The Cloud UI’s parameter form currently renders a date picker for
date
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.
Copy code
{
  "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:
Copy code
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.
k
oopsy wrong channel - sorry Marv ❤️