From e40d60c66fdd605f8777507c460c1eeaf74f46c2 Mon Sep 17 00:00:00 2001 From: Ken Tang <34528743+kentang2017@users.noreply.github.com> Date: Sun, 15 Sep 2024 13:28:50 +0800 Subject: [PATCH] Update app.py --- app.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app.py b/app.py index 58591c0..422e842 100644 --- a/app.py +++ b/app.py @@ -36,6 +36,14 @@ def get_file_content_as_string1(path): with st.sidebar: pp_date=st.date_input("日期",pdlm.now(tz='Asia/Shanghai').date()) pp_time=st.time_input("時間",pdlm.now(tz='Asia/Shanghai').time()) + + # 設置時間初始值 + if 'pp_time' not in st.session_state: + st.session_state.pp_time = pdlm.now(tz='Asia/Shanghai').time() + +# 使用儲存的時間初始值 + pp_time = st.time_input("時間", value=st.session_state.pp_time) + st.session_state.pp_time = pp_time p = str(pp_date).split("-") pp = str(pp_time).split(":") y = int(p[0])