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

Error when minDate and maxDate is null or undefined #227

Closed
junbong opened this issue Aug 2, 2018 · 3 comments
Closed

Error when minDate and maxDate is null or undefined #227

junbong opened this issue Aug 2, 2018 · 3 comments

Comments

@junbong
Copy link
Contributor

junbong commented Aug 2, 2018

Subject of the issue

Error occurred when minDate and maxDate of <Calendar /> is null or undefined.
I tested this issue in demo page.

[BUG] Bug Reproduce Steps

<Calendar
  locale={rdrLocales[this.state.locale]}
  date={this.state.datePickerInternational}
  minDate={null}
  maxDate={null}
  onChange={this.handleChange.bind(this, 'datePickerInternational')}
  className={'PreviewArea'}
/>

2018-08-02 8 11 23
2018-08-02 8 11 41

<Calendar
  locale={rdrLocales[this.state.locale]}
  date={this.state.datePickerInternational}
  minDate={undefined}
  maxDate={undefined}
  onChange={this.handleChange.bind(this, 'datePickerInternational')}
  className={'PreviewArea'}
/>

2018-08-02 8 13 35

[BUG] Expected behaviour

Work well with minDate and maxDate.

Environment

Package Version: 1.0.0-alpha3
React version: react@16.4.2
Node version: v9.5.0
Browser: 67.0.3396.99

@mkg0
Copy link
Collaborator

mkg0 commented Aug 2, 2018

Hi @junbong
It's not a bug. For both of Calendar and DateRange, max/min Dates should be defined. If you want to extend it to maybe next 2k years, still you can.

@mkg0 mkg0 closed this as completed Aug 2, 2018
@junbong
Copy link
Contributor Author

junbong commented Aug 6, 2018

@mkg0 Thanks for reply.
And then, how do I dynamically set the minimum date and the maximum date?
For example, if there are two calendars, depending on the status of each calendars, how minDate and maxDate could be changed? and how this values could be CLEARED?

@mkg0
Copy link
Collaborator

mkg0 commented Aug 7, 2018

I don't know your use case but you can use min/max date props declaratively.

https://codesandbox.io/s/1o6z36404q

For an example calendars are bound and the second calendar's minDate is two days after the first calendar date.

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

No branches or pull requests

2 participants