Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Fixing off by one error in DatePickerRange. #930

Merged
merged 5 commits into from
Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- [#923](https://github.com/plotly/dash-core-components/pull/923)
Set autoComplete to off in `dcc.Dropdown`. This fixes [#808](https://github.com/plotly/dash-core-components/issues/808)

### Fixed
- [#930](https://github.com/plotly/dash-core-components/pull/930) Fixed a bug [#867](https://github.com/plotly/dash-core-components/issues/867) with `DatePickerRange` that would sometimes shift the allowed dates by one day.

## [1.15.0] - 2021-01-19
### Fixed
- [#905](https://github.com/plotly/dash-core-components/pull/905) Make sure the `figure` prop of `dcc.Graph` receives updates from user interactions in the graph, by using the same `layout` object as provided in the prop rather than cloning it. Fixes [#879](https://github.com/plotly/dash-core-components/issues/879).
Expand Down
5 changes: 4 additions & 1 deletion src/fragments/DatePickerRange.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ export default class DatePickerRange extends Component {
}

isOutsideRange(date) {
const {min_date_allowed, max_date_allowed} = this.props;
const {min_date_allowed, max_date_allowed} = convertToMoment(
this.props,
['min_date_allowed', 'max_date_allowed']
);

return (
(min_date_allowed && date.isBefore(min_date_allowed)) ||
Expand Down
29 changes: 29 additions & 0 deletions tests/integration/calendar/test_date_picker_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,32 @@ def test_dtpr003_no_initial_month_no_min_date_start_date(dash_dcc):
"#dps-initial-month .CalendarMonth.CalendarMonth_1[data-visible=true] strong",
"August 2019",
)


def test_dtpr004_max_and_min_dates_are_clickable(dash_dcc):
app = dash.Dash(__name__)
app.layout = html.Div(
[
dcc.DatePickerRange(
id="dps-initial-month",
start_date=datetime(2021, 1, 11),
end_date=datetime(2021, 1, 19),
max_date_allowed=datetime(2021, 1, 20),
min_date_allowed=datetime(2021, 1, 10),
)
]
)

dash_dcc.start_server(app)

dash_dcc.select_date_range("dps-initial-month", (10, 20))

dash_dcc.wait_for_text_to_equal(
'#dps-initial-month .DateInput_input.DateInput_input_1[placeholder="Start Date"]',
"01/10/2021",
)

dash_dcc.wait_for_text_to_equal(
'#dps-initial-month .DateInput_input.DateInput_input_1[placeholder="End Date"]',
"01/20/2021",
)