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

Entering non-int number values into inputs crashes the page #38

Closed
emilyuhde opened this issue Jun 27, 2019 · 3 comments
Closed

Entering non-int number values into inputs crashes the page #38

emilyuhde opened this issue Jun 27, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@emilyuhde
Copy link
Contributor

emilyuhde commented Jun 27, 2019

If you go to a TimePicker and enter a non-int value into one of the number inputs, it will crash and blank our your entire screen and give a console error. It seems like the TimePicker isn't handling non-int numbers very well.

For example, load up a page with the TimePicker on it that has a default value initialized ( such as '13:00' or new Date()) and overwrite the minutes field to 0.0, your page will crash. It also happens if you have a TimePicker with the value initialized to null. For example, enter 1 for the hours, 1.0 for the minutes, and then select AM. It crashes as soon as onChange is triggered.

This is the console error in Chrome:

Uncaught Error: Failed to get hours from date: 09:.0:00.
at getHours (dates.js:25)
at getHoursMinutes (dates.js:33)
at TimeInput.getProcessedValue (TimeInput.js:369)
at TimeInput.onChangeExternal (TimeInput.js:265)
at callCallback (react-dom.development.js:16433)
at commitUpdateEffects (react-dom.development.js:16472)
at commitUpdateQueue (react-dom.development.js:16460)
at commitLifeCycles (react-dom.development.js:17364)
at commitAllLifeCycles (react-dom.development.js:18736)
at HTMLUnknownElement.callCallback (react-dom.development.js:149)
at Object.invokeGuardedCallbackDev (react-dom.development.js:199)
at invokeGuardedCallback (react-dom.development.js:256)
at commitRoot (react-dom.development.js:18948)
at react-dom.development.js:20418
at Object.unstable_runWithPriority (scheduler.development.js:255)
at completeRoot (react-dom.development.js:20417)
at performWorkOnRoot (react-dom.development.js:20346)
at performWork (react-dom.development.js:20254)
at flushInteractiveUpdates$1 (react-dom.development.js:20503)
at batchedUpdates (react-dom.development.js:2163)
at dispatchEvent (react-dom.development.js:4905)
at react-dom.development.js:20490
at Object.unstable_runWithPriority (scheduler.development.js:255)
at interactiveUpdates$1 (react-dom.development.js:20489)
at interactiveUpdates (react-dom.development.js:2170)
at dispatchInteractiveEvent (react-dom.development.js:4882)
getHours @ dates.js:25
getHoursMinutes @ dates.js:33
getProcessedValue @ TimeInput.js:369
(anonymous) @ TimeInput.js:265
callCallback @ react-dom.development.js:16433
commitUpdateEffects @ react-dom.development.js:16472
commitUpdateQueue @ react-dom.development.js:16460
commitLifeCycles @ react-dom.development.js:17364
commitAllLifeCycles @ react-dom.development.js:18736
callCallback @ react-dom.development.js:149
invokeGuardedCallbackDev @ react-dom.development.js:199
invokeGuardedCallback @ react-dom.development.js:256
commitRoot @ react-dom.development.js:18948
(anonymous) @ react-dom.development.js:20418
unstable_runWithPriority @ scheduler.development.js:255
completeRoot @ react-dom.development.js:20417
performWorkOnRoot @ react-dom.development.js:20346
performWork @ react-dom.development.js:20254
flushInteractiveUpdates$1 @ react-dom.development.js:20503
batchedUpdates @ react-dom.development.js:2163
dispatchEvent @ react-dom.development.js:4905
(anonymous) @ react-dom.development.js:20490
unstable_runWithPriority @ scheduler.development.js:255
interactiveUpdates$1 @ react-dom.development.js:20489
interactiveUpdates @ react-dom.development.js:2170
dispatchInteractiveEvent @ react-dom.development.js:4882

This is the console error in Firefox:

Error: "Failed to get hours from date: 09:.0:00."
getHours dates.js:25
getHoursMinutes dates.js:33
value TimeInput.js:369
t TimeInput.js:265
React 5
unstable_runWithPriority scheduler.production.min.js:18
React 7
unstable_runWithPriority scheduler.production.min.js:18
React 2
react-dom.production.min.js:198:186
React 7
unstable_runWithPriority scheduler.production.min.js:18
React 7
unstable_runWithPriority scheduler.production.min.js:18
React 2
Error: Failed to get hours from date: 09:.0:00. dates.js:25
getHours dates.js:25
getHoursMinutes dates.js:33
value TimeInput.js:369
t TimeInput.js:265
React 5
unstable_runWithPriority scheduler.production.min.js:18
React 7
unstable_runWithPriority scheduler.production.min.js:18
React 2
Pn self-hosted:1029

@emilyuhde emilyuhde changed the title Entering non-int number values into inputs crashes Entering non-int number values into inputs crashes the page Jun 27, 2019
@emilyuhde
Copy link
Contributor Author

I've been looking at this issue some more to see if there's some way I can try to fix it on my end as a user of the component, and it doesn't look good so far. It's up to you as the maintainer @wojtekmaj but personally I'd say this is bad enough to warrant a hotfix and release.

@wojtekmaj
Copy link
Owner

Partially fixed by 1a640fe - not crashing anymore, but still allowing symbols to be typed, resulting rather messy input.

@wojtekmaj wojtekmaj self-assigned this Jul 11, 2019
@wojtekmaj wojtekmaj added the bug Something isn't working label Jul 11, 2019
@wojtekmaj
Copy link
Owner

Closing this ticket as v3.6.1 fixed the crash - will open second one for rejecting the dot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants