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.
I am using this to pick a time in the app, but when I only change the AM to PM or vice versa, the time doesn't update correctly.
<DatePicker
modal
open={open}
date={time}
mode={mode}
androidVariant="nativeAndroid"
is24hourSource="locale"
onConfirm={selectedTime => {
const newTime = new Date(selectedTime); // Force selection to a new Date instance
console.log('🚀 ~ newTime:', newTime);
setTime(newTime);
}}
onCancel={() => setOpen(false)}
locale="en"
/>
**Smartphone (please complete the following information):**
- OS: [Android]
- React Native version [e.g. 0.72.4]
- react-native-date-picker version [e.g. 5.0.2]
I am using this to pick a time in the app, but when I only change the AM to PM or vice versa, the time doesn't update correctly.
<DatePicker modal open={open} date={time} mode={mode} androidVariant="nativeAndroid" is24hourSource="locale" onConfirm={selectedTime => { const newTime = new Date(selectedTime); // Force selection to a new Date instance console.log('🚀 ~ newTime:', newTime); setTime(newTime); }} onCancel={() => setOpen(false)} locale="en" />