Skip to content

Instantly share code, notes, and snippets.

@Hu-Wentao
Created November 18, 2024 14:11
Show Gist options
  • Select an option

  • Save Hu-Wentao/e8a0ee802c36f129833331bacaeb1f91 to your computer and use it in GitHub Desktop.

Select an option

Save Hu-Wentao/e8a0ee802c36f129833331bacaeb1f91 to your computer and use it in GitHub Desktop.
Streamlit js_eval
from streamlit_js_eval import streamlit_js_eval
def get_timezone(component_key='TZ') -> str:
"""get Timezone
:returns 'Aisa/Shanghai' """
return streamlit_js_eval(
js_expressions=f'Intl.DateTimeFormat().resolvedOptions().timeZone', key=component_key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment