mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/cief-dashboard.git
synced 2026-08-29 09:24:23 +00:00
32 lines
1.0 KiB
Python
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()
|
|
# ])
|