Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datepicker crashes with non-standard time intervals - still an issue #2262

Closed
saltire opened this issue Jul 13, 2020 · 2 comments
Closed

Datepicker crashes with non-standard time intervals - still an issue #2262

saltire opened this issue Jul 13, 2020 · 2 comments

Comments

@saltire
Copy link
Contributor

saltire commented Jul 13, 2020

Describe the bug
Same as #2169 - although a fix has been merged, it's still possible to get this error in v3.1.3.

To Reproduce
Steps to reproduce the behavior:

  1. Go to www.reactdatepicker.com, then the "Exclude times" example
  2. In the code, add the option timeIntervals={90}
  3. Manually change the date in the input to July 13, 2020 2:59 PM.
  4. Click the input to bring up the calendar.
  5. See error: TypeError: t is undefined (Firefox), TypeError: Cannot read property 'offsetTop' of undefined (Chrome), or TypeError: undefined is not an object (evaluating 't.offsetTop') (Safari).

Expected behavior
The calendar should appear, allowing the user to select a time at a 90-minute interval, regardless of the currently selected time.

Desktop (please complete the following information):

  • OS: macOS
  • Browser: tested in Firefox 78, Chrome 83, and Safari 13.1.1

Additional context
It happens at many different combinations of timeIntervals and selected. Here's a test for timepicker_test.js that triggers the error in v3.1.3:

  it("should handle 90 min time intervals", () => {
    renderDatePicker("July 13, 2020 2:59 PM", {
      timeIntervals: 90,
      showTimeSelect: true
    });
    expect(getInputString()).to.equal("July 13, 2020 2:59 PM");

    ReactDOM.findDOMNode(datePicker.input).focus();

    setManually("July 13, 2020 3:00 PM");
    expect(getInputString()).to.equal("July 13, 2020 3:00 PM");
  });
saltire added a commit to saltire/react-datepicker that referenced this issue Aug 21, 2020
…01#2262)

Centers the time window on the nearest time before or equal to the active time, regardless of its hour.
saltire added a commit to saltire/react-datepicker that referenced this issue Aug 21, 2020
…01#2262)

Centers the time window on the nearest time before or equal to the active time, regardless of its hour.
martijnrusschen pushed a commit that referenced this issue Aug 22, 2020
Centers the time window on the nearest time before or equal to the active time, regardless of its hour.
@martijnrusschen
Copy link
Member

#2350

@saltire
Copy link
Contributor Author

saltire commented Aug 28, 2020

Hey, thanks for merging my PR. Any idea when we'll see a release?

p-rogas pushed a commit to p-rogas/react-datepicker that referenced this issue Mar 22, 2023
…01#2262) (Hacker0x01#2350)

Centers the time window on the nearest time before or equal to the active time, regardless of its hour.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants