Coder Social home page Coder Social logo

Comments (3)

jkimbo avatar jkimbo commented on July 17, 2024

@jimmyn do you have a stack trace or example code that triggers the error?

from react-daterange-picker.

jimmyn avatar jimmyn commented on July 17, 2024

If you update moment-range up to 1.1.0 it will trigger the error in example.
Apparently moment-range doesn't work as a moment object when you don't pass any arguments any more. And const lang = moment().localeData() causes error

This is the stuck trace.

DateRange (moment-range.js?a4bb:47)
(anonymous function) (CalendarMonth.js?0bc9:59)
(anonymous function) (index.js:1187)
__webpack_require__ (index.js:20)
(anonymous function) (DateRangePicker.js?6f5d:38)
(anonymous function) (index.js:1133)
__webpack_require__ (index.js:20)
(anonymous function) (index.js?4a85:11)
(anonymous function) (index.js:1127)
__webpack_require__ (index.js:20)
(anonymous function) (index.jsx?073c:9)
(anonymous function) (index.js:1091)
__webpack_require__ (index.js:20)
(anonymous function) (index.js?e382:4)
(anonymous function) (index.js:47)
__webpack_require__ (index.js:20)
(anonymous function) (index.js:40)
(anonymous function) (index.js:43)

Here is the code that causes this error

function DateRange(start, end) {
  var parts;
  var s = start;
  var e = end;

  if (arguments.length === 1 || end === undefined) {
    if (start.length === 2) { // Infer array
      s = start[0];
      e = start[1];
    }
    else {
      parts = start.split('/');
      s = parts[0];
      e = parts[1];
    }
  }

  this.start = moment(s);
  this.end   = moment(e);
}

from react-daterange-picker.

AndrewIngram avatar AndrewIngram commented on July 17, 2024

Trying to work out the most suitable fix for this. Obviously we can pin the version of moment-range, but then if you're using it anywhere else, there'll be issues in terms of bundle sizes or compatibility. Maybe we can put in a little compatibility shim in the short term.

from react-daterange-picker.

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.