Git Product home page Git Product logo

Comments (9)

jirikolarik avatar jirikolarik commented on May 18, 2024

Hi,

this handling is not included in a lib, try to use something like this:

const onDatesChange = ({ startDate, endDate, focusedInput }) => {
  moment.range(startDate, endDate).by('days', (day) => {
    if (isDateBlocked(day)) {
      return console.log(day, 'is blocked');
    }
  });

  this.setState({ ...this.state, focus: focusedInput }, () =>
    this.setState({ ...this.state, startDate, endDate })
  );
}

this code shouldn't update state with startDate and endDate in your state but print into console information that you cannot select this time range. There could be some nice popup message or any other information, but implementation is up to you :)

from react-native-dates.

alexcouret avatar alexcouret commented on May 18, 2024

Thanks for the answer, it causes my app to freeze though...

from react-native-dates.

jirikolarik avatar jirikolarik commented on May 18, 2024

My bad, I'll try to reproduce it locally and then let you know

from react-native-dates.

alexcouret avatar alexcouret commented on May 18, 2024

I've done a Pull Request for this issue, let me know :)

from react-native-dates.

GrishmaM avatar GrishmaM commented on May 18, 2024

@OzoTek is this working for you ?
i'm getting Unhandled JS Exception: _moment2.default.range is not a function
do you have any solution for this ?

from react-native-dates.

alexcouret avatar alexcouret commented on May 18, 2024

I'm using "moment-range": "^2.2.0" as a dependency in my project, it works well. I think there have been some breaking changes with the v3 that are not supported by the lib.

from react-native-dates.

GrishmaM avatar GrishmaM commented on May 18, 2024

thanx it worked for me

from react-native-dates.

jirikolarik avatar jirikolarik commented on May 18, 2024

You fixed it with #13 right @OzoTek ?

from react-native-dates.

alexcouret avatar alexcouret commented on May 18, 2024

Yes, I'm closing.

from react-native-dates.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.