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

Fix crash with non-standard time intervals (#2169, #2262) #2350

Merged
merged 1 commit into from Aug 22, 2020

Conversation

saltire
Copy link
Contributor

@saltire saltire commented Aug 21, 2020

Centers the list of times on the nearest time before or equal to the active time, regardless of its hour.

Previously the code would try to center the list of times on the nearest time within the same hour. With time intervals larger than one hour, sometimes there would be no valid candidates, and the calcCenterPosition function would crash.

This change does a more simple comparison, and there should now always be a valid ref to a "center" list item.

Fixes #2169, #2262

@codecov
Copy link

codecov bot commented Aug 21, 2020

Codecov Report

Merging #2350 into master will decrease coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2350      +/-   ##
==========================================
- Coverage   92.10%   92.06%   -0.04%     
==========================================
  Files          20       20              
  Lines        1254     1248       -6     
  Branches      332      328       -4     
==========================================
- Hits         1155     1149       -6     
  Misses         40       40              
  Partials       59       59              
Impacted Files Coverage Δ
src/date_utils.js 99.10% <ø> (ø)
src/time.jsx 88.00% <100.00%> (-1.29%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62d82b3...977e426. Read the comment docs.

…01#2262)

Centers the time window on the nearest time before or equal to the active time, regardless of its hour.
@martijnrusschen
Copy link
Member

Amazing, thanks!

@martijnrusschen martijnrusschen merged commit 40ffae7 into Hacker0x01:master Aug 22, 2020
p-rogas pushed a commit to p-rogas/react-datepicker that referenced this pull request 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

Successfully merging this pull request may close these issues.

Datepicker crashes with non-standard time intervals
2 participants