Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picker Format Issue #819

Open
ankitbacancy opened this issue May 21, 2024 · 7 comments
Open

Picker Format Issue #819

ankitbacancy opened this issue May 21, 2024 · 7 comments

Comments

@ankitbacancy
Copy link

ankitbacancy commented May 21, 2024

Describe the bug
For date only picker, the format of picker in iOS and Android is different.

In iOS, It appears with DD MM YYYY format,
Screenshot 2024-05-21 at 2 25 27 PM

In Android, it appears with MM DD YYYY format,
Screenshot 2024-05-21 at 2 25 54 PM

Expected behavior
The format should be the same for both iOS and Android pickers.

Code to regenerate the issue

import React, { useState } from 'react'
import { Button } from 'react-native'
import DatePicker from 'react-native-date-picker'

export default () => {
  const [date, setDate] = useState(new Date())
  const [open, setOpen] = useState(false)

  return (
    <>
      <Button title="Open" onPress={() => setOpen(true)} />
      <DatePicker
        modal
        mode="date"
        open={open}
        date={date}
        onConfirm={(date) => {
          setOpen(false)
          setDate(date)
        }}
        onCancel={() => {
          setOpen(false)
        }}
      />
    </>
  )
}

Smartphone (please complete the following information):

  • OS: iOS 17.4 & Android 14
  • React Native version 0.72.4
  • react-native-date-picker version 4.3.7
@henninghall
Copy link
Owner

please provide a fully runnable code example

@ankitbacancy
Copy link
Author

@henninghall Updated the code.

@henninghall
Copy link
Owner

What locale / language is in use in the two different phones?

@ankitbacancy
Copy link
Author

@henninghall It's default en .

@HaiderTWJ
Copy link

HaiderTWJ commented May 24, 2024

You need to use locale prop and pass locale="en-GB". You will be able to see same format on both platforms.

@ankitbacancy
Copy link
Author

You need to use locale prop and pass locale="en-GB". You will be able to see same format on both platforms.

I have already tried and it didn't work.

@henninghall
Copy link
Owner

Please send screenshots of the system language/time settings on each phone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants