React-dates: IE 11 issue - .includes() is not supported

Created on 31 Aug 2016  路  3Comments  路  Source: airbnb/react-dates

Bug

In IE11 I get the following error when selecting a day

Object doesn't support property or method 'includes'

Cause

It goes wrong here

Proposed solution

includes is not supported in IE, can we replace it by indexOf?
http://stackoverflow.com/a/31119502

bug

Most helpful comment

We do typically assume people are using https://npmjs.com/airbnb-js-shims or the equivalent, but this is simple enough that we should use indexOf here.

All 3 comments

We do typically assume people are using https://npmjs.com/airbnb-js-shims or the equivalent, but this is simple enough that we should use indexOf here.

Instead I used array-includes so we didn't have to mess with index comparison. Will be included in the next release.

That fixed things nicely, and also patched up a couple of unrelated bugs. I could hug you. Thank you, sir!

Was this page helpful?
0 / 5 - 0 ratings