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.

"minimumDate" is not respected if the user confirms the date without changing the initial value

See original GitHub issue

In src/CustomDatePickerIOS/index.js you initialize defaultProps.date to a new Date() and because defaultProps is static, it doesn’t generally get recreated every time we display the picker.

Our application requires a minimumDate which is typically 1 day from the instant the user displays the picker.

If the user displays the picker - it shows the minimum date correctly (the underlying iOS picker handles this) but, if the user confirms immediately without changing the date, _handleDateChange never fires in your library and consequently, the state.date that your library returns is the one from defaultProps … which is NOT the date the picker was displaying and in our case, always less than the minimum date.

At a minimum, we’d like your library to return the date the picker actually displayed and which the user thought they were confirming.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
kartavyaparekh96commented, Dec 29, 2018

I have solution for temporary not permanent… @LutherBaker @gish94


constructor(props) {
    super(props);
    this.state = {
      changeDate: false,
    };
  }

<DateTimePicker
          isVisible={this.state.isDateTimePickerVisible}
          onConfirm={this._handleDatePicked}
          onCancel={this._hideDateTimePicker}
          onDateChange={this.datechange} //--> Add this function
          minimumDate={new Date()} // --> your minimun date
         
        /> 

  datechange = () => this.setState({changeDate: true});
_handleDatePicked = delivery_date => {
    if(Platform.OS == "ios"){
      if(this.state.changeDate == false){
          var fulldate = new Date(); //--> your minimum date
        this.setState({delivery_date : moment(fulldate, "YYYY-MM-DD").format("YYYY-MM-DD")})
      }else {
        this.setState({delivery_date});
      }
    } else {
      this.setState({delivery_date});
    }
  this._hideDateTimePicker();
  };

0reactions
GuleriaAshishcommented, Oct 27, 2020

@mmazzarolo is this bug resolved now or not ? Because i am also facing this issue and not able to find out any solution for it. Please suggest me what to do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: min date from data set - Qlik Community - 1430891
I need ignore date filter for minimum value. My goal is to get minimum date "01.01.2016" in set analysis when selected any date...
Read more >
Minimum and maximum date in UIDatePicker - Stack Overflow
User negative value (-) to subtract and positive value to add date component. 1. Set minimum date yourDatePicker.minimumDate = Calendar.current.date(byAdding: .
Read more >
Zuora Quotes Version 10 Release Notes
Quotes version 10.13 shows the following notification when you create an amendment quote without changing anything on the charges: There are currently no...
Read more >
Untitled
Just as we don't change the time or date formats to The "c" (or currency) ... When no currency symbol is provided, default...
Read more >
EU Individual Case Safety Report (ICSR)1 Implementation ...
Updates related to the Clinical Trials Regulation (EU) No 536/2014; ... Conformity of stored data with the initial ICSR, if not received.
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