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.

Object doesn't support property or method 'from'

See original GitHub issue

I get the error message in the title when running my simple application in the IE. In chrome everything is just fine. The error points to the dayPicker.js file on line 128 in the function _toConsumableArray(arr). Any ideas on this? this is my wrapper component

import React from 'react';
import moment from 'moment';
import { SingleDatePicker, toMomentObject } from 'react-dates';
import toLocalizedDateString from './../../utils/toDateString';
class SingleDatePickerWrapper extends React.Component {
  constructor(props) {
    super(props);
    this.format = 'DD.MM.YYYY';
    this.state = {
      focused: false,
    };
  }

  onDateChange = (date) => {
    this.props.onBlur(toLocalizedDateString(date, this.format));
  }

  onFocusChange = ({ focused }) => {
    this.setState({ focused });
  }


  render = () => {
    const { focused } = this.state;
    let newProps = {};
    if (!this.props.onlyFuture){
      newProps = { ...this.props, isOutsideRange: () => {} };
    } else {
      newProps = { ...this.props };
    }
    return (
      <SingleDatePicker
        {...newProps}
        id="date_input"
        date={toMomentObject(this.props.date, this.format)}
        focusedInput={'endDate'}
        focused={focused}
        displayFormat={'DD-MMM-YYYY'}
        onDateChange={this.onDateChange}
        onFocusChange={this.onFocusChange}
      />
    );
  }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
ljharbcommented, Sep 23, 2016
2reactions
razhcommented, Sep 23, 2016

Babel converts the ES2015 spread operator ([...array]) to the _toConsumableArray helper function.

http://babeljs.io/repl/#?presets=es2015&code=[...array]

function _toConsumableArray(arr) {
  if (Array.isArray(arr)) {
    for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { 
      arr2[i] = arr[i]; 
    } 
    return arr2; 
  } else {
    return Array.from(arr); 
  } 
}

This uses ES2015 Array.from which is not available in IE. You can use Babel’s polyfill for this:

http://babeljs.io/docs/usage/polyfill/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object Doesn't Support this Property or Method - Microsoft Learn
The "object doesn't support this property or method" error occurs when you try to use a method or property that the specified object...
Read more >
IE 11 AngularJS error - Object doesn't support property or ...
When I open this in IE11 I get the error in a popup SCRIPT438: Object doesn't support property or method 'from' which is...
Read more >
Object Doesn't Support This Property or Method Error
This error occurs when you are trying to use a method/property that the specified object does not support (i.e. it is not found...
Read more >
Object doesn't support property or method 'from': IE11 #63
The following code will give a 'error: Object doesn't support property or method 'from''. It is part of the inline script.
Read more >
Object Doesn't support property or method '$1X'
First of all, sp.js IS loaded when you execute your code, otherwise you will get a "undefined" error message when calling "SP.ClientContext.
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