prefect icon indicating copy to clipboard operation
prefect copied to clipboard

Custom Run Timezone follows local machine timezone instead of Timezone set in Preferences

Open robfreedy opened this issue 7 months ago • 0 comments

Bug summary

Current Behavior: In the UI, when selecting the Custom Run for a deployed flow that has a datetime parameter, the Datetime widget incorrectly converts the datetime passed in to the local machine's timezone instead (which if expected behavior, the conversion is incorrect)

Expected behavior: Using the timezone specified in the user's preferences when submitting datetime parameters through the datetime widget.

Reproduction:

Run the following in your local environment

from prefect import flow
from datetime import datetime

@flow
def datetime_flow(input_datetime: datetime):
    print(f"Received datetime: {input_datetime}")
    return input_datetime

if __name__ == "__main__":
    # Example usage with current time
    datetime_flow.serve()

In user preferences, select UTC as the timezone.

Image

Then, go to the deployment and hit custom run.

Image

Look at the result flow runs inputted parameters and see the incorrect datetime as it takes the local machine's time/timezone (for me this is UTC−05:00 or EST)

Image

Version info

Version:             3.4.1
API version:         0.8.4
Python version:      3.11.10
Git commit:          b47ad8e1
Built:               Thu, May 08, 2025 08:42 PM
OS/Arch:             darwin/arm64
Profile:             test
Server type:         cloud
Pydantic version:    2.10.2

Additional context

No response

robfreedy avatar May 15 '25 14:05 robfreedy