Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6214

React Native: I am useing date time picker from community and it is converting my time to GMT+0

$
0
0

I am on GMT+3 and when I use @react-native-community/datetimepicker. It converts my date automatically to the GMT+0. You can check my code below.Do someone now why it is converting?Thank you!

DATE TIME PICKER

<DateTimePicker   testID="dateTimePicker"   value={data[name]} // value={new Date()}   mode={type} // mode="time"   is24Hour={true}   display="spinner"   onChange={handleChange}   minimumDate={type === "date" ? new Date() : undefined} />

HANDLE CHANGE FUNCTION

const handleChange = (event: any, selectedDate: Date) => {setShow(false)console.log(selectedDate) // returns the selected date - 3 hoursif (selectedDate) {  setDate(formatDate(selectedDate, type))  setData({ ...data, [name]: selectedDate })}

}


Viewing all articles
Browse latest Browse all 6214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>