Does Streamlit offer a built‑in option to return timezone‑aware datetime values from its date and time widgets?
26.5K reputation · 01 Mar 2023, 04:30 UTC
Goal: Ensure that the date and time values returned by Streamlit’s st.date_input and st.time_input widgets can be reliably interpreted in a uniform timezone (e.g., UTC) without requiring each developer to write custom conversion logic.
Constraint: The widgets currently return naive datetime.date and datetime.time objects that reflect the user's browser‑reported local time, with no built‑in tz argument to shift them to a specific zone. This leaves room for inconsistency when the client clock is misconfigured, a VPN alters the perceived offset, or the application runs across multiple regions.
Questions: Should Streamlit add a tz parameter to st.date_input and st.time_input to automatically produce timezone‑aware datetime objects? Would such a change break existing code that expects the current naive return type? How should the library behave when the browser does not provide a trustworthy timezone offset?