Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Date Input] minDate/maxDate doesn't work outside of default range #980

Closed
jchomicki opened this issue Apr 12, 2017 · 7 comments
Closed

Comments

@jchomicki
Copy link

jchomicki commented Apr 12, 2017

Bug report

  • Package version(s): datetime 1.12.0
  • Browser and OS versions: Chrome 57.0.2987.133 (64-bit)

Steps to reproduce

  1. Create a Date Input with maxDate={new Date(2020, 5, 5)} and minDate={new Date(1990, 5, 5)}
  2. Try changing value to 2019-04-20

Actual behavior

Dropdown fails to open or is disabled and an error is thrown in the console:

datePicker.tsx?0de8:169 Uncaught Error: [Blueprint] <DatePicker> value prop must be within minDate and maxDate bounds
    at DatePicker.validateProps (eval at <anonymous> (app.js?v=local:2629), <anonymous>:185:19)
    at DatePicker.AbstractComponent.componentWillReceiveProps (eval at <anonymous> (app.js?v=local:430), <anonymous>:37:14)
    at DatePicker.componentWillReceiveProps (eval at <anonymous> (app.js?v=local:2629), <anonymous>:168:52)
    at eval (eval at <anonymous> (app.js?v=local:5858), <anonymous>:611:23)
    at measureLifeCyclePerf (eval at <anonymous> (app.js?v=local:5858), <anonymous>:75:12)
    at ReactCompositeComponentWrapper.updateComponent (eval at <anonymous> (app.js?v=local:5858), <anonymous>:610:9)
    at ReactCompositeComponentWrapper.receiveComponent (eval at <anonymous> (app.js?v=local:5858), <anonymous>:547:10)
    at Object.receiveComponent (eval at <anonymous> (app.js?v=local:1161), <anonymous>:125:22)
    at Object.updateChildren (eval at <anonymous> (app.js?v=local:13710), <anonymous>:109:25)
    at ReactDOMComponent._reconcilerUpdateChildren (eval at <anonymous> (app.js?v=local:13878), <anonymous>:208:32)

Expected behavior

Setting the min/maxDate outside of the default 20 year window should be allowed.

@giladgray
Copy link
Contributor

this is related to #977 (converting validation errors to warnings) but probably needs some design thinking for how we handle dates outside of the valid window.

@giladgray
Copy link
Contributor

I cannot reproduce this in the docs DateInput example. renders as expected, no errors and correct date ranges:

const MAX = new Date(2020, 5, 5);
const MIN = new Date(1990, 5, 5);
<DateInput {...this.state} value={new Date(2019, 4, 20)} maxDate={MAX} minDate={MIN} />

also tried with defaultValue and clicking on 2019-4-20.

@jchomicki would you be able to share the exact code you use to create the DateInput?

@giladgray
Copy link
Contributor

giladgray commented Apr 13, 2017

aha the issue is in how @mfedderly implemented the DateTimePicker composition in #922. we need to set <DateTimePicker datePickerProps={this.props}> instead of simply spreading this.props.

@TheAifam5
Copy link

TheAifam5 commented Mar 5, 2019

The problem still exist when user types the date manually.

I use default value of minDate and when user types:
02/02/2

and next number crashes whole page.

I using the latest react and blueprintjs (checking for updates like every day :D)

@silviodeligios
Copy link

I have the same issue

@patrickk
Copy link

patrickk commented Jan 3, 2020

Why was this closed? @giladgray

@adidahiya
Copy link
Contributor

@TheAifam5 @silviodeligios @patrickk it was closed for reasons similar to this: #3407 (comment)

we can continue discussion in #3861 if you'd like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants