question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

minYear, maxYear, minMonth, maxMonth?

See original GitHub issue

The docs isn’t clear about this, it only cited the following:

// Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined
minDate={'2012-05-10'}
// Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined
maxDate={'2012-05-30'}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
eggybotcommented, Apr 5, 2018

Hi Guys, is there a way we can limit the Arrows base on minDate and maxDate? so if I set my min-max date to

  minDate={'2018-04-15'}
  maxDate={'2018-05-25'}

so if I use the arrow left/right I can go only on the month of April and May. thus locking other months to be view.

thanks,

1reaction
Saujanmgrcommented, Mar 28, 2022

@eggybot, @s349856186 and for other who wants to disableArrowLeft and disableArrowRight after certain date.

In my project, I am using moment JS to get the date. Requirement: There should be a minimum date and maximum date, based on this library they provided, there is a function minDate and maxDate (This will only make the dates before min date and after maxdate disable not make the arrow button disable) so, in order to disable the arrow button:

My code is on Class component:

state = { disableArrowLeft: false, // THESE ARE USE FOR ENABLING AND DISABLING ARROW BUTTONS disableArrowRight: false, minDate:‘’, maxDate:‘’ }

componentDidMount() { let todayDate = moment().format(‘YYYY-MM-DD’); let maxDate = moment(todayDate).add(60, ‘days’).format(‘YYYY-MM-DD’); let minDate = moment(todayDate).subtract(360, ‘days’).format(‘YYYY-MM-DD’); // HERE FOR GETTING THE MIN AND MAX DATE BASED ON MY PROJECT this.setState({ maxDate, minDate, }); }

<Calendar disableArrowLeft={this.state.disableArrowLeft} disableArrowRight={this.state.disableArrowRight}

onMonthChange={date => {

        if (moment(date.dateString).isSame(this.state.maxDate, 'month')) {
          this.setState({
            disableArrowRight: true,
          });
        } else {
          this.setState({
            disableArrowRight: false,
          });
        }

        if (moment(date.dateString).isSame(this.state.minDate, 'month')) {
          this.setState({
            disableArrowLeft: true,
          });
        } else {
          this.setState({
            disableArrowLeft: false,
          });
        }

      }}

/>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android datepicker min max date before api level 11
datePicker.init(minYear, minMonth, minDay, new OnDateChangedListener() { public void ... updateDate(maxYear, maxMonth, maxDay); }else if(year < minYear ...
Read more >
Loop through months in every year. - Qlik Community - 1007979
Note: i need to use minMonth and maxMonth due to where condition. Temp_month: ... max(year(wo_completionDate)) as maxYear.
Read more >
Keyword $tagMCMONTHRANGE - AutoIt
Keyword Reference. $tagMCMONTHRANGE. Retrieves date information that represents the high and low limits of a month calendar control's display.
Read more >
Solved: Running Total with funky measure
To do so I have created measure as below. Plan Per Quarter = VAR MinYear = CALCULATE ( MIN ( dimCzas[Rok] ), FILTER...
Read more >
android.widget.DatePicker.updateDate java code examples
updateDate(minYear, minMonth, minDay); view.updateDate(maxYear, maxMonth, maxDay); view.updateDate(maxYear, maxMonth, maxDay); view.updateDate(maxYear ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found