React-date-picker: Date picker crashes in IE11

Created on 29 Jan 2021  路  10Comments  路  Source: wojtekmaj/react-date-picker

When I type the date in IE11, it seems correct on month and date but then when it gets to the year it crashes with the error
SCRIPT5022: Invalid date: Mon Jan 01 1 00:00:00 GMT-0500 (SA Pacific Standard Time)

IE11 is supposed to have support for internationalization but even so I've tried adding the polyfill and this is still happening.
The locale is locale="en-US"
Any suggestions on what might be wrong would be appreciated.

bug

All 10 comments

It seems as you type it initially tries to create a Date with year 1 which in IE11 is an Invalid Date.
This line above for the minValue also generates an Invalid Date
var defaultMinDate = new Date('0001-01-01');
Screen Shot 2021-01-29 at 8 35 21 AM

It's actually a much simpler problem than internationalization.

IE handles this date just fine, it's when it gets passed to new Date() again that messes it up :D Apparently IE has a problem with dates < Unix 0, when passed to Date() constructor. Have a look:

obraz

Ok, I added a check so that new Date() isn't called if we already have a date to begin with, which should, at least looking at the last 2 lines of the screenshot above, help with the issue.

338

Could you have a look, maybe apply this fix by hand in your project and see if this fixes the problem? Once we have the confirmation it works for you we can release the fix.

I tried and it fixes it but it doesn't show the numbers being typed, then the same error comes up this time from the Calendar.

Thanks so much!

It is expected - calendar suffers from the very same issue and I raised this PR https://github.com/wojtekmaj/react-calendar/pull/480 to fix the same issue there.

Release incoming 馃憖 We'll see if we could fix the numbers not shown, although that would be a different ticket.

Thank you so much!

v8.0.7 released with the fix applied to both React-Date-Picker and React-Calendar.

All good now, Thank you!!

Like, _all_? The numbers typed are also shown?

Yes, for some reason it wasn't picking up my changes for the calendar, and you were faster in fixing the whole thing so just upgraded and now it's ok. I am running IE in parallels and sometimes it's weird.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aladinflux picture aladinflux  路  3Comments

bhldev picture bhldev  路  6Comments

JMS-1 picture JMS-1  路  7Comments

cavishek39 picture cavishek39  路  3Comments

frankhn picture frankhn  路  5Comments