react-native-datetimepicker / datetimepicker

React Native date & time picker component for iOS, Android and Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Date format is inconsistent (iOS only?)

bpeltonc opened this issue · comments

Bug Report

Summary

At least on iOS, the date format as displayed on the button when the picker is not open is inconsistent.

Reproducible sample code

Simply clone this repository, install deps via yarn install && cd example && npx pod-install, then build and run the app on any iOS target.

Steps to reproduce

  1. Open the iOS Date Picker
  2. Select March 20, 2024
  3. The button shows "3/20/2024"

Describe what you expected to happen:

  1. Open the iOS Date Picker
  2. Select March 20, 2024
  3. The button shows "Mar 20, 2024"

Environment info

npx react-native info output:

System:
  OS: macOS 14.4.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 98.97 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.9.0
    path: ~/.nvm/versions/node/v20.9.0/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 8.19.4
    path: ~/datetimepicker/node_modules/.bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.2
    path: /Users/brandon/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK:
    API Levels:
      - "27"
      - "30"
      - "31"
      - "33"
      - "34"
    Build Tools:
      - 28.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-30 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-UpsideDownCakePrivacySandbox | Google Play ARM 64 v8a
      - android-VanillaIceCream | Google Play ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10227.8.2321.11479570
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.4.1
    path: /Users/brandon/.jenv/shims/javac
  Ruby:
    version: 3.2.1
    path: /Users/brandon/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.7
    wanted: ^0.72.7
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: true
iOS:
  hermesEnabled: false
  newArchEnabled: false

datetimepicker version: 7.6.4

iOS / Android version: 17.4

same issue here

Same issue as well. I select August 1, 2024 and the display renders "Aug 1, 2024". Select August 8, 2024 and the display renders "8/8/24".

I'll play with the width of the control to see if it's just a space saving feature that's undocumented.

@wheelie33 that's right, a space saving

A quick fix for now

<DateTimePicker 
    style={{ paddingHorizontal: 30, left: -30 }}
    ...other props
/>
commented

Same problem here, also the dateFormat seems buggy on iphone too. Would be nice to be able to customize like dddd day string week format like Fri. Thu. etc