Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Number of days from the DateRangePicker object inputs

Hello everyone,
I have a rather basic question, since I am new to plotly dash, and to python in general.
I would like to make some operations between dates collected from a date-picker-range object. I would like to have the number of days between the start and end date.
Please ignore the imported and unused library (since I just copied part of my code here) and the useless objects.
The code below runs, and shows the objects, but the callback doesn’t change anything. And I know it is because that is not the right way to compute the difference between the 2 days from and datepickerrange.
Any help will be appreciated.
Thank you all.

import pandas as pd
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_table_experiments as dt
from datetime import datetime as dti
from datetime import date

external_stylesheets = [‘’]

app = dash.Dash(name, external_stylesheets=external_stylesheets)
app.config.supress_callback_exceptions = True

app.layout = html.Div([
html.H4(children=‘Meteo Station of the SFI’),
min_date_allowed=dti(2017, 1, 1),
max_date_allowed=dti(2018, 12, 26),
initial_visible_month=dti(2017, 8, 5),
end_date=dti(2017, 8, 25)
html.Button(id=‘button’, n_clicks=0, children=‘Show table’),
html.Div(dt.DataTable(id=‘datatable’, rows=[{}], max_rows_in_viewport=15))
@app.callback(dash.dependencies.Output(‘output-display’, ‘children’),
[dash.dependencies.Input(‘date-picker-range’, ‘start_date’),
dash.dependencies.Input(‘date-picker-range’, ‘end_date’)]
def update_output(start_date, end_date, min_date_allowed):
if start_date is not None:
diff = dti(end_date) - dti(start_date)
n_days = diff.days
return n_days
if name == ‘main’: