Skip to content

Error with setting minimum and maximum dates #1006

@Crare

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

Describe what you expected to happen:

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

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