Skip to content

Error with setting minimum and maximum dates #1006

Closed

Description

@Crare

Bug report

Summary

I have error when setting minimum and maximum dates. the datepicker works the first time ok, but the second time you use it (open the modal) with different min and max dates it breaks and gives error message:


Unexpected error occured
Apologies..The app will close now
Please restart the app
Unable to set a visible month that is before the minimum or after the maximum date.
"4 AppName.debug.dylib
0x0000000108082a6c
_ZL22FIRCLSTerminateHandlerv +
520",
"5 libc++abi.dylib
0x000000018028e150
_ZSt11_terminatePFVVE + 12",
"6 libc++abi.dylib
0x000000018028e100
_ZSt9terminatev + 52",
"7 libdispatch.dylib
0x000000018016cd50
_dispatch_client_callout + 36",
"8 libdispatch.dylib
0x000000018017bb24
_dispatch_main_queue_drain + 1272")

I'm using react-native-modal-datetime-picker which uses react-native-datetimepicker underneath it, so I think this might be the actual place for issue. Please do correct me if that is not the case.

Reproducible sample code

Steps to reproduce

  1. …
  2. …

Describe what you expected to happen:

  1. …
  2. …

Environment info

npx react-native info output:

info Fetching system and libraries information...
System:
  OS: macOS 15.5
  CPU: (10) arm64 Apple M1 Max
  Memory: 103.73 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.2.0
    path: ~/.nvm/versions/node/v22.2.0/bin/node
  Yarn:
    version: 4.7.0
    path: ~/.nvm/versions/node/v22.2.0/bin/yarn
  npm:
    version: 10.7.0
    path: ~/.nvm/versions/node/v22.2.0/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK:
    API Levels:
      - "23"
      - "24"
      - "25"
      - "30"
      - "31"
      - "33"
      - "34"
      - "35"
      - "36"
    Build Tools:
      - 23.0.3
      - 24.0.3
      - 26.0.3
      - 28.0.3
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 33.0.0
      - 33.0.1
      - 33.0.2
      - 34.0.0
      - 35.0.0
      - 36.0.0
      - 36.0.0
      - 36.0.0
    System Images:
      - android-23 | ARM 64 v8a
      - android-23 | Google APIs ARM 64 v8a
      - android-24 | ARM 64 v8a
      - android-24 | Google APIs ARM 64 v8a
      - android-25 | ARM 64 v8a
      - android-25 | Google APIs ARM 64 v8a
      - android-26 | ARM 64 v8a
      - android-28 | Google ARM64-V8a Play ARM 64 v8a
      - android-31 | ARM 64 v8a
      - android-31 | Google APIs ARM 64 v8a
      - android-31 | Google Play ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-35 | Google Play ARM 64 v8a
      - android-36 | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.26094.121.2512.13991807
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 3.4.1
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.78.3
    wanted: 0.78.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

info React Native v0.81.1 is now available (your project is running on v0.78.3).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.81.1
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.78.3&to=0.81.1
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".

Time zone name (If the problem you have is related to unexpected time / date. See list in https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

datetimepicker version:
"react-native-modal-datetime-picker": "18.0.0"
"@react-native-community/datetimepicker": "^8.3.0"

iOS / Android version: iOS 17.2

Activity

  1. MuhammadUsman786786 commented on Sep 5, 2025

    @MuhammadUsman786786

    In my case, crash was happening because
    Because i was having the 2 picker on the same screen,

    and to one picker i was passing the minDate only and to the 2nd picker i was passing the max date only

    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to set a visible month that is before the minimum or after the maximum date.'
    CoreSimulator 1010.15 - Device: iPhone 16 Pro (3C99D78A-92F6-4DC6-9BE3-4E1FA0BD8B5A) - Runtime: iOS
    
    Image
  2. MuhammadUsman786786 commented on Sep 5, 2025

    @MuhammadUsman786786

    this this confit it was crashing display = 'default';
    i set the display = 'spinner'; and crash gone

  3. ArviinM commented on Sep 6, 2025

    @ArviinM

    this this confit it was crashing display = 'default'; i set the display = 'spinner'; and crash gone

    this is a good temporary fix but yes using the default display crashes the app.

  4. Crare commented on Sep 8, 2025

    @Crare
    Author

    Yes we had similar issue. There is two input fields, one for start date and one for end date for a period of time to be given. this uses two of these modal components. it has min and max date ranges set based on the start date. if start date changes, max-date for the end-date-input needs to be update n-days forward.

  5. yonitou commented on Sep 11, 2025

    @yonitou

    Same issue

  6. Junveloper commented on Nov 20, 2025

    @Junveloper

    Yes we had similar issue. There is two input fields, one for start date and one for end date for a period of time to be given. this uses two of these modal components. it has min and max date ranges set based on the start date. if start date changes, max-date for the end-date-input needs to be update n-days forward.

    Hi there, we have the exact same form structure as you described and experiencing this issue. Would you mind guiding me through how you solved this?

  7. usmanindustryis commented on Nov 20, 2025

    @usmanindustryis

    As I mentioned above change the display prop to spinner, it should be fixed

  8. jfonsecarivera commented on Nov 28, 2025

    @jfonsecarivera

    @usmanindustryis Saying "don't use this feature" is not a "fix"

  9. jfonsecarivera commented on Nov 28, 2025

    @jfonsecarivera

    also, please fix

  10. Junveloper commented on Nov 29, 2025

    @Junveloper

    @vuciv The issue has been fixed from #1026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions