Display correct time in browsers timezone

@marketemp I’ve used this in different tabs, but not in a multi page app yet. I don’t think it should be a problem.

Here is an example with two Outputs:


import dash
import dash_html_components as html
from dash.dependencies import Input, Output

app = dash.Dash(__name__)

app.layout = html.Div(
    [
        html.H1(id="title1",),
        html.H1(id="title2",)
    ]
)


app.clientside_callback(
    """
    function(id) {          
        const local_date_str = new Date().toLocaleString();                   
        return ["Title 1 date: " + local_date_str, 
                "Title 2 date: " + local_date_str]
    }
    """,
    Output("title1", "children"),
    Output("title2", "children"),
    Input("title1", "id")
)


if __name__ == "__main__":
    app.run_server(debug=True)