datetimepicker icon indicating copy to clipboard operation
datetimepicker copied to clipboard

Navigating through calendar breaks maximumDate prop

Open AlixH opened this issue 3 years ago • 1 comments

Bug report

Summary

I open the modal with a default date of 2021-03-01 When I navigate to the year 2022, the header of the modal still shows the same month and day e.g 2022-03-01, even if the maximumDate is 2022-01-20. However, the maximum selectable date is 2022-01-20. So if I click on "confirm" and I don't click on the date inside the calendar, my date will not respect the maximumDate and the output will be 2022-03-01.

Reproducible sample code

Demo is here: https://snack.expo.dev/@alixh/react-native-modal-datetime-picker

Steps to reproduce

  1. Open the modal datepicker with default date being 2021-03-01
  2. Go to 2022
  3. Observe that the header date is 2022-03-01
  4. Click on 'ok' (Do not select any date)
  5. The ouput will be 2022-03-01

Describe what you expected to happen:

  1. Open the modal datepicker with default date being 2021-03-01
  2. Go to 2022
  3. Observe that the header date is limited to the maximumDate prop
  4. Click on 'ok' (Do not select any date)
  5. The ouput will be the maximumDate

Environment info

npx react-native info output:

System:
OS: macOS 12.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 28.47 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
API Levels: 28, 29, 30
Build Tools: 29.0.2, 29.0.3, 30.0.3
System Images: android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_271 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.2 => 0.64.2
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

datetimepicker version: 5.1.0

iOS / Android version: Android 11 (only tested Android yet)

AlixH avatar Jan 24 '22 09:01 AlixH

I can confirm that the same issue happens on iOS 15.5.

System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1
    Memory: 97.00 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.16.0 - ~/.config/nvm/versions/node/v16.16.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.11.0 - ~/.config/nvm/versions/node/v16.16.0/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0
    react-native: 0.69.5 => 0.69.5
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
    

MSzalowski avatar Oct 10 '22 13:10 MSzalowski

:tada: This issue has been resolved in version 6.7.1 :tada:

If this package helps you, consider sponsoring us! :rocket:

vonovak avatar Nov 26 '22 20:11 vonovak