From 3d00e1772f2632fe5370ebd53bd08b5372341a9a Mon Sep 17 00:00:00 2001 From: alishobeiri Date: Fri, 18 Aug 2017 15:09:52 -0400 Subject: [PATCH] v0.12.3 - fixed max date range issue (#58) --- packages/dash-core-components/CHANGELOG.md | 4 ++++ .../dash_core_components/version.py | 2 +- packages/dash-core-components/package.json | 3 ++- .../src/components/DatePickerRange.react.js | 12 ++++++++---- .../src/components/DatePickerSingle.react.js | 9 ++++++--- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/packages/dash-core-components/CHANGELOG.md b/packages/dash-core-components/CHANGELOG.md index 6811287453..abd008cc34 100644 --- a/packages/dash-core-components/CHANGELOG.md +++ b/packages/dash-core-components/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.12.3] - 2017-08-17 +### Fixed +- Previously, the `max_date_allowed` could not be selected. This issue has been fixed, issue first reported in https://community.plot.ly/t/solved-datepicker-in-dash/4816/10 + ## [0.12.2] - 2017-08-10 ### Fixed - Previously, when the `options` of a `dcc.Dropdown` would change, the options would no longer be searchable. That has been fixed. Issue was originally reported in https://community.plot.ly/t/dropdown-not-searching-values-when-typing/5323/3 diff --git a/packages/dash-core-components/dash_core_components/version.py b/packages/dash-core-components/dash_core_components/version.py index 92a60bdf25..c4e914ae8b 100644 --- a/packages/dash-core-components/dash_core_components/version.py +++ b/packages/dash-core-components/dash_core_components/version.py @@ -1 +1 @@ -__version__ = '0.12.2' +__version__ = '0.12.3' diff --git a/packages/dash-core-components/package.json b/packages/dash-core-components/package.json index 60a47f87d7..5efcc08665 100644 --- a/packages/dash-core-components/package.json +++ b/packages/dash-core-components/package.json @@ -1,6 +1,6 @@ { "name": "dash-core-components", - "version": "0.12.2", + "version": "0.12.3", "description": "Core component suite for Dash", "repository": { "type": "git", @@ -32,6 +32,7 @@ "ramda": "^0.23.0", "rc-slider": "^6.1.0", "react": "^15.4.0", + "react-addons-shallow-compare": "^15.6.0", "react-dates": "^12.3.0", "react-dom": "^15.4.0", "react-markdown": "^2.4.5", diff --git a/packages/dash-core-components/src/components/DatePickerRange.react.js b/packages/dash-core-components/src/components/DatePickerRange.react.js index c5c2354321..c283016c66 100644 --- a/packages/dash-core-components/src/components/DatePickerRange.react.js +++ b/packages/dash-core-components/src/components/DatePickerRange.react.js @@ -61,6 +61,7 @@ export default class DatePickerRange extends Component { if (typeof props.maxDateAllowed !== 'undefined') { max = moment(props.maxDateAllowed); + max.add(1, 'days'); } try { @@ -177,7 +178,8 @@ export default class DatePickerRange extends Component { isOutsideRange={(date) => { if (typeof this.state.minDateAllowed !== 'undefined' && typeof this.state.maxDateAllowed !== 'undefined') { - return date < this.state.minDateAllowed || date >= this.state.maxDateAllowed; + return date < this.state.minDateAllowed || + date >= this.state.maxDateAllowed; } else if (typeof this.state.minDateAllowed === 'undefined' && typeof this.state.maxDateAllowed !== 'undefined') { return date >= this.state.maxDateAllowed; @@ -357,9 +359,11 @@ DatePickerRange.propTypes = { */ disabled: PropTypes.bool, - /** - * If True, there will be a button that allows for clearing the dates - */ + /** + * Whether or not the dropdown is "clearable", that is, whether or + * not a small "x" appears on the right of the dropdown that removes + * the selected value. + */ clearable: PropTypes.bool, /** diff --git a/packages/dash-core-components/src/components/DatePickerSingle.react.js b/packages/dash-core-components/src/components/DatePickerSingle.react.js index c14f1456a6..54c01cb2c6 100644 --- a/packages/dash-core-components/src/components/DatePickerSingle.react.js +++ b/packages/dash-core-components/src/components/DatePickerSingle.react.js @@ -53,6 +53,7 @@ export default class DatePickerSingle extends Component { if (typeof props.maxDateAllowed !== 'undefined') { max = moment(props.maxDateAllowed); + max.add(1, 'days'); } return { date, initialVisibleMonth, min, max }; @@ -282,9 +283,11 @@ DatePickerSingle.propTypes = { */ disabled: PropTypes.bool, - /** - * If True, there will be a button that allows for clearing the dates - */ + /** + * Whether or not the dropdown is "clearable", that is, whether or + * not a small "x" appears on the right of the dropdown that removes + * the selected value. + */ clearable: PropTypes.bool, /**