20 lines
759 B
Python
20 lines
759 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
|
||
|
||
# Callback for updating clocks (unchanged)
|
||
@app.callback(
|
||
[Output('pst-clock', 'children'),
|
||
Output('cst-clock', 'children'),
|
||
Output('est-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')
|
||
return f"𝕏: {pst_time}", f"🚀: {cst_time}", f"🏛️/🌴: {est_time}"
|