Skip to content

Conversation

@anderconal
Copy link

What's new on this PR?

  • New optional prop minDate for InputMoment component.
  • New optional prop maxDate for InputMoment component.
  • Next & previous month buttons disabled depending on minDate and maxDate.
  • Previous & after dates disabled depending on minDate and maxDate.
  • CSS updates in order to apply disabled styles.
  • Gray color range updated at variables.less with two previously used gray colors.
  • Example updated using both minDate and maxDate props.
  • README.md updated with example using minDate & maxDate.
  • render snapshot test updated in order to make it work with the new changes.

Screenshots

Previous month button disabled + previous dates disabled + after dates disabled

screen shot 2017-11-03 at 18 09 07

Next month button disabled + after dates disabled

screen shot 2017-11-03 at 18 09 43

How to test?

  • Using the updated example (feel free to change the minDate and maxDate moments) play with the input trying to:
    • Click on previous & after dates (nothing should happen).
    • Click on previous & next month buttons (nothing should happen if disabled, same behaviour if enable).
    • Click on valid days (previous behaviour should be the same).
    • Whatever you would think in order to break & improve it.

Related issue

min and max dates

Ander Conal added 9 commits October 31, 2017 17:48
Allow no minDate prop
Allow no maxDate prop
Allow no minDate & no maxDate props
Change the way we calculate disabled days (using isBefore and isAfter instead of isBetween)
Start of month as date if nextMonth clicked & moment is after maxDate
End of month as date if prevMonth clicked & moment is before minDate
Set current time each time same date on next or prev month is not between minDate & maxDate
@anderconal anderconal mentioned this pull request Nov 3, 2017
@codeaid
Copy link

codeaid commented Mar 22, 2018

Are there any plans to merge this in? It's been 4 months since this PR was opened.

@sandraloeve
Copy link

sandraloeve commented Jan 18, 2019

@wangzuo @anderconal Can this merge? It would be a very nice to have 👍

@anderconal
Copy link
Author

@sandragajowski I can't merge it, @wangzuo is the one who should if everything is fine

@zhr1130
Copy link

zhr1130 commented Jun 25, 2019

@wangzuo can we merge it ? It's a really great feature to have

@shadowangle
Copy link

@wangzuo can you merge this?

@akzarma
Copy link

akzarma commented Nov 24, 2020

Hey @wangzuo can you merge this?

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

Successfully merging this pull request may close these issues.

6 participants