henninghall / react-native-date-picker

React Native Date Picker is datetime picker for Android and iOS. It includes date, time and datetime picker modes. The datepicker is customizable and is supporting different languages. It's written with native code to achieve the best possible look, feel and performance.
MIT License
2.14k stars 326 forks source link

Picker Format Issue #819

Open ankitbacancy opened 1 month ago

ankitbacancy commented 1 month ago

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):

henninghall commented 1 month ago

please provide a fully runnable code example

ankitbacancy commented 1 month ago

@henninghall Updated the code.

henninghall commented 1 month ago

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

ankitbacancy commented 1 month ago

@henninghall It's default en .

HaiderTWJ commented 1 month ago

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

ankitbacancy commented 1 month ago

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 commented 1 month ago

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