2025-03-05 10:24:46 +08:00
|
|
|
|
import pytz
|
|
|
|
|
from pkg.dash.app_init import app
|
|
|
|
|
from dash.dependencies import Input, Output
|
|
|
|
|
from pkg.config import pacific,central,eastern
|
|
|
|
|
from datetime import datetime
|
2025-03-05 10:44:38 +08:00
|
|
|
|
from dash import html
|
2025-03-05 10:24:46 +08:00
|
|
|
|
|
|
|
|
|
@app.callback(
|
2025-03-05 10:44:38 +08:00
|
|
|
|
[Output('pst-clock', 'children')],
|
2025-03-05 10:24:46 +08:00
|
|
|
|
[Input('clock-interval', 'n_intervals')]
|
|
|
|
|
)
|
|
|
|
|
def update_clocks(n):
|
|
|
|
|
now_utc = datetime.now(pytz.UTC)
|
|
|
|
|
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')
|
2025-03-05 10:44:38 +08:00
|
|
|
|
|
|
|
|
|
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]
|
|
|
|
|
|
|
|
|
|
|