Skip to content

Fix division by zero minute interval #997

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

Conversation

dblazeski
Copy link
Contributor

@dblazeski dblazeski commented Aug 2, 2025

Summary

The application crashes when minuteInterval is not provided or is 0. The issue was introduced in the previous PR which modified the minimum date check #992

Fixes #996

Test Plan

  • Add the component
  • Dont provide minimumDate prop
  • The app crashes

What's required for testing (prerequisites)?

What are the steps to reproduce (after prerequisites)?

Compatibility

OS Implemented
iOS
Android

Checklist

  • I have tested this on a device and a simulator
  • I added the documentation in README.md
  • I updated the typed files (TS and Flow)
  • I added a sample use of the API in the example project (example/App.js)
  • I have added automated tests, either in JS or e2e tests, as applicable

…nterval is 0

- Add safety check in adjustMinimumDate function to handle minuteInterval <= 0
- Return minimumDate unchanged when no valid interval is provided
- Add debug logging to track minuteInterval values for troubleshooting
- Fixes EXC_ARITHMETIC (EXC_I386_DIV) crash when modulo operation encounters zero divisor

This fixes crashes that occur when DateTimePicker is used without explicitly setting minuteInterval,
as the default value becomes 0 instead of the expected 1, causing division by zero in the modulo operation.
Only log when minuteInterval <= 0 and we return date unchanged.
Remove verbose logging for normal operation to reduce console noise.
@vonovak vonovak merged commit e65a5d3 into react-native-datetimepicker:master Aug 8, 2025
1 of 3 checks passed
vonovak pushed a commit that referenced this pull request Aug 8, 2025
## [8.4.4](v8.4.3...v8.4.4) (2025-08-08)

### Bug Fixes

* **ios:** remove potential division by zero minute interval ([#997](#997)) ([e65a5d3](e65a5d3))
@vonovak
Copy link
Member

vonovak commented Aug 8, 2025

🎉 This issue has been resolved in version 8.4.4 🎉

If this package helps you, consider sponsoring us! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] Crash: EXC_ARITHMETIC in adjustMinimumDate when minimumDate prop is used
2 participants