实时时间显示对齐
This commit is contained in:
parent
2bf5cf28b7
commit
938aa3ea8d
@ -20,9 +20,7 @@ def layout_config(app):
|
||||
html.Div(
|
||||
id='clock-tooltip',
|
||||
children=[
|
||||
html.Div(id='pst-clock'),
|
||||
html.Div(id='cst-clock'),
|
||||
html.Div(id='est-clock')
|
||||
html.Div(id='pst-clock')
|
||||
],
|
||||
style={
|
||||
'position': 'absolute',
|
||||
|
@ -3,12 +3,10 @@ from pkg.dash.app_init import app
|
||||
from dash.dependencies import Input, Output
|
||||
from pkg.config import pacific,central,eastern
|
||||
from datetime import datetime
|
||||
from dash import html
|
||||
|
||||
# Callback for updating clocks (unchanged)
|
||||
@app.callback(
|
||||
[Output('pst-clock', 'children'),
|
||||
Output('cst-clock', 'children'),
|
||||
Output('est-clock', 'children')],
|
||||
[Output('pst-clock', 'children')],
|
||||
[Input('clock-interval', 'n_intervals')]
|
||||
)
|
||||
def update_clocks(n):
|
||||
@ -16,4 +14,17 @@ def update_clocks(n):
|
||||
pst_time = now_utc.astimezone(pacific).strftime('%Y-%m-%d %H:%M:%S PST')
|
||||
cst_time = now_utc.astimezone(central).strftime('%Y-%m-%d %H:%M:%S CST')
|
||||
est_time = now_utc.astimezone(eastern).strftime('%Y-%m-%d %H:%M:%S EST')
|
||||
return f"𝕏: {pst_time}", f"🚀: {cst_time}", f"🏛️/🌴: {est_time}"
|
||||
|
||||
table = html.Table([
|
||||
html.Tr([html.Td('𝕏', style={'textAlign': 'center'}), html.Td(pst_time)]),
|
||||
html.Tr([html.Td('🚀', style={'textAlign': 'center'}), html.Td(cst_time)]),
|
||||
html.Tr([html.Td('🏛️🌴', style={'textAlign': 'center'}), html.Td(est_time)])
|
||||
], style={
|
||||
'width': '100%',
|
||||
'textAlign': 'left',
|
||||
'borderCollapse': 'collapse'
|
||||
})
|
||||
|
||||
return [table]
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user