Skip to content

[iOS] Crash: EXC_ARITHMETIC in adjustMinimumDate when minimumDate prop is used #996

@amsAbiola

Description

@amsAbiola

Description :
My application crashes with a native EXC_ARITHMETIC (SIGFPE) error when rendering the DatePicker component with the minimumDate prop set. The crash happens on iOS when the component is about to be displayed.

Library Version:
@react-native-community/datetimepicker: 8.4.3

React Native Version:
0.79.2

Platform:
iOS

Steps to Reproduce:

Render a <DatePicker> component.

Provide a minimumDate prop (e.g., new Date('1900-01-01')).

Provide a maximumDate prop (e.g., new Date()).

Trigger the component to be displayed.

Expected Behavior:
The DatePicker should render without crashing.

Actual Behavior:
The app crashes immediately.

Code Snippet:

import DatePicker from '@react-native-community/datetimepicker';

const MyComponent = () => {
  const maximumDate = new Date();
  maximumDate.setFullYear(maximumDate.getFullYear() - 12);

  return (
    <DatePicker
      value={new Date()}
      mode="date"
      display="inline"
      maximumDate={maximumDate}
      minimumDate={new Date(1900, 0, 1)} // This prop causes the crash
    />
  );
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions