Files
cief-dashboard/apps/test.py
T
2020-10-12 11:00:10 +08:00

32 lines
1.0 KiB
Python

from datetime import date
from app import *
layout = html.Div([
dcc.DatePickerRange(
id='input-date_picker',
min_date_allowed=pd.Timestamp(2018, 1, 1),
max_date_allowed=pd.Timestamp(2020, 12, 31),
initial_visible_month=pd.Timestamp(2020, 9, 1),
start_date=pd.Timestamp(2020, 1, 1),
end_date=pd.Timestamp(2020, 9, 1)
),
html.Div(id='output-text')
])
@app.callback(
dash.dependencies.Output('output-text', 'children'),
[dash.dependencies.Input('input-date_picker', 'start_date'),
dash.dependencies.Input('input-date_picker', 'end_date')])
def update_output(start_date, end_date):
string_prefix = 'You have selected: '
if start_date is not None and end_date is not None:
string_prefix = string_prefix + 'Start Date: ' + start_date + ' | '+ end_date
if len(string_prefix) == len('You have selected: '):
return 'Select a date to see it displayed here'
else:
return string_prefix
#dbc.Row([
# dbc.Col()
# ])