arqex / react-datetime

A lightweight but complete datetime picker react component.
2k stars 870 forks source link

Call correct log method in DateTime component to prevent crash on invalid input #803

Closed niklasnatter closed 3 years ago

niklasnatter commented 3 years ago

Description

This PR adjusts the code of the DateTime component to call the correct log method. At the moment, this code crashes the component if the value prop of the DateTime component does not match the expected format. See https://github.com/arqex/react-datetime/issues/801

Motivation and Context

The log method was moved outside the class in https://github.com/arqex/react-datetime/commit/d4450038cd901f1e0f31bcd365448820f60c6f67#diff-cae892f0886b91915576f17fd54c818f7ef44b721a3885d4a742039f1c8cad03L557-R611 Unfortunately, the call this method inside of setViewDate was not adjusted. This causes the error described above.

Checklist

[x] I have not included any built dist files (us maintainers do that prior to a new release)
[ ] I have added tests covering my changes
[x] All new and existing tests pass
[ ] My changes required the documentation to be updated
  [ ] I have updated the documentation accordingly
  [ ] I have updated the TypeScript 1.8 type definitions accordingly
  [ ] I have updated the TypeScript 2.0+ type definitions accordingly
arqex commented 3 years ago

Thanks @nnatter. It was a small refactor that was being made (and not finished), and somehow it got in to the master branch when merging the changes for the last version.