Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

datepicker doesn't open if date values are None #115

Closed

Description

@chriddyp

Originally reported in https://community.plot.ly/t/datepickerrange-clearable-in-tabs-not-working-as-expected/6850/4

import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
from datetime import datetime as dtime

app = dash.Dash()


app.config['suppress_callback_exceptions'] = True
app.layout = html.Div([
    dcc.DatePickerRange(
        id='Dr1',
        clearable=True,
        reopen_calendar_on_clear=True,
        start_date_placeholder_text='Select a date',
        end_date=dtime.today().strftime("%Y-%m-%d")
    ),
    html.Div(id='output')
])


@app.callback(
    Output('output', 'children'),
    [Input('Dr1', 'start_date'),
     Input('Dr1', 'end_date')])
def dates_selected(start_date, end_date):
    value = "From- %s  To-   %s" % (start_date, end_date)
    return value


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

Quite a few error messages in the console
image

Activity

  1. added
    dash-type-bug
    on Nov 23, 2017
  2. xblad commented on May 14, 2018

    @xblad

    @chriddyp
    Hi Chris, I think the issue above is related to the fact, that DatePickerRange's attribute initial_visible_month isn't defined. Maybe the default value could be set (e.g. datetime.today()) and it would solve the issue (AirBnB's date-picker shows current month by default as well).

  3. 90debasish commented on Feb 27, 2019

    @90debasish

    Hi Chris,

    in the above example what i am facing issue is :

    1. In the beginning when the date picker starts it prints as None- This is completley ok
    2. However when you select some date and then let say clear those dates then it still shows the previous value but it should show as None since the dates are clear.

    The problem with the initial approach is:

    1. Let say we selected some date from and end; we get the data from those period- This is completley ok
    2. However let say if we want only data which is less than the end period after previous selection.-------> here we are not able to do so since we still have from value which still has the previous value even if we clear it in the date picker
  4. byronz commented on Jul 29, 2019

    @byronz
    Contributor

    issue has been fixed in

    dash                 1.0.2
    dash-core-components 1.0.0
    dash-html-components 1.0.0
    dash-renderer        1.0.0
    dash-table           4.0.2
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dash-meta-good_first_issuedash-type-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions