React-datepicker: Uncaught RangeError: Invalid interval

Created on 28 Nov 2018  ·  7Comments  ·  Source: Hacker0x01/react-datepicker

Expected behavior

Nothing. I should be able to error handle on my own.

Actual behavior

When a start date is chosen after the end date, an error pops up and my application crashes.

Steps to reproduce

Use the date range version of react-datepicker and choose an endDate that is before the startDate. In the demo on your site, I am not allowed to select an End Date before the Start Date, like physically cannot. Wonder why my result is different.

wontfix

Most helpful comment

It is fixed now. Could you release it, please?

All 7 comments

I think the component doesn't do it natively and lets you implement your own behavior.
You have to manage this in the _onChange_ callbacks : for instance block the date change or change the start/end depending of what is the value.
For my part I made the start and end have the same value if the period is invalid and I think in the demo it is the first option that is implemented.

Does it show how that is implemented? Also not to be an asset, but I think
that's kinda dumb, that should be on the user of the library. I like that
there is validation but I think it should be a choice and not in the form
of a application-crashing bug.

On Wed, Nov 28, 2018, 1:37 PM Jérémie Richardeau <[email protected]
wrote:

I think the component doesn't do it natively and lets you implement your
own behavior.
You have to manage this in the onChange callbacks : for instance block
the date change or change the start/end depending of what is the value.
For my part I made the start and end have the same value if the period is
invalid and I think in the demo it is the first option that is implemented.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Hacker0x01/react-datepicker/issues/1563#issuecomment-442556991,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AZHNAfFFcUz4tL6u4Hisq29pBc2Uiz5bks5uztfvgaJpZM4Y4DOZ
.

Показывает, как это реализовано? Также не быть активом, но я думаю, что это немного глупо, это должно быть на пользователе библиотеки. Мне нравится, что есть валидация, но я думаю, что это должен быть выбор, а не в виде ошибки, связанной с приложением.
...
On Wed, Nov 28, 2018, 1:37 PM Jérémie Richardeau @.* wrote: I think the component doesn't do it natively and lets you implement your own behavior. You have to manage this in the onChange callbacks : for instance block the date change or change the start/end depending of what is the value. For my part I made the start and end have the same value if the period is invalid and I think in the demo it is the first option that is implemented. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#1563 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AZHNAfFFcUz4tL6u4Hisq29pBc2Uiz5bks5uztfvgaJpZM4Y4DOZ .

I agree. In addition, when I enter a date from the keyboard (dd.mm.yyyy format), the react-datepicker interprets the date incorrectly, which causes the same error. Validate the data must user.

Opened a PR against this (https://github.com/Hacker0x01/react-datepicker/pull/1577). Comments welcome!

Also, this is most likely beyond this ticket, but I submitted another
addressing that if you begin to type 20 for the year or 19 for the 20th
century, the other date updates automatically to 2020 of 2019 for 20th
century. Weird that it doesn't wait for the user to finish typing I think.

On Wed, Dec 12, 2018, 8:08 PM Jonathan Keam <[email protected] wrote:

Opened a PR against this (#1577
https://github.com/Hacker0x01/react-datepicker/pull/1577). Comments
welcome!


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Hacker0x01/react-datepicker/issues/1563#issuecomment-446804640,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AZHNAQhJ7eiRU1EXDNl_2ElLh_Ahmojwks5u4ah5gaJpZM4Y4DOZ
.

It is fixed now. Could you release it, please?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sarav1234 picture sarav1234  ·  3Comments

dhruvparmar372 picture dhruvparmar372  ·  3Comments

jcabrerazuniga picture jcabrerazuniga  ·  3Comments

jbccollins picture jbccollins  ·  3Comments

ahribori picture ahribori  ·  3Comments