Date picker on iOS has different selected value then Date received in onChange callback
See original GitHub issueBug
DateTimePicker on iOS return in onChange method different then selected one. Different is one day.
Environment info
React native info output:
info Fetching system and libraries information...
System:
OS: macOS 10.15.2
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 128.34 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 13.7.0 - /usr/local/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.13.6 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.6010548
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: ^16.12.0 => 16.12.0
react-native: 0.61.4 => 0.61.4
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-cli: 2.0.1
Library version: 2.2.1
Steps To Reproduce
- Create simple app with DateTimePicker.
- Add item like this:
<DateTimePicker testID="dateTimePicker" timeZoneOffsetInMinutes={0} value={parseDate(value)} mode={'date'} is24Hour={true} display="default" onChange={(event, date) => { debugger; console.log("Event: " + event.type); console.log("Selected date: " + date)); />
- Run it on iOS simulator. …
Describe what you expected to happen:
- Date on picker should be the same as it is in onChange callback function
Issue Analytics
- State:
- Created 4 years ago
- Reactions:21
- Comments:17
Top Results From Across the Web
Date picker on iOS has different selected value then ... - GitHub
Describe what you expected to happen: Date on picker should be the same as it is in onChange callback function.
Read more >Date Picker with UIControlEvents.valueChanged doesn't work ...
Strange. This appears to be a bug in date pickers that are set to UIDatePickerMode.countDownTimer mode. You can get around most of the...
Read more >Solved: Onchange event often triggers when screen becomes
I get a notification that should only be displayed when a user is trying to change the date. It doesn't happen every time...
Read more >React custom datepicker: Step-by-step - LogRocket Blog
Set up a robust and attractive datepicker in React that acts as an ... For example, with various date formats used globally, a...
Read more ><input type="color"> - HTML: HyperText Markup Language
The value is never in any other form, and is never empty. ... the user re-opens the color picker), a change event is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
there is a “timeZoneOffsetInMinutes” prop, setting it to the user’s timezone offset solved this.
I am having the same issue both on android and ios the difference is one day. Edit: Solved the issue by using the
toLocaleDateString()
methodIt’s a temporary fix the issue needs to be resolved since the timezone offset has no effect in the date picker.