31 lines
1006 B
Python
31 lines
1006 B
Python
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
|
||
from dash import html
|
||
|
||
@app.callback(
|
||
[Output('pst-clock', 'children')],
|
||
[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')
|
||
|
||
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]
|
||
|
||
|