VitaliiBlagodir / cordova-plugin-datepicker

MIT License
318 stars 350 forks source link

I cant edit date/time with keyboard #14

Open bordeux opened 10 years ago

bordeux commented 10 years ago

With fix from 20 may, i cant edit time/date with keyboard. When i edit and click on "ok", the result is nothing. Please back to previus revision, or change plugin version to new :)

VitaliiBlagodir commented 10 years ago

Hi! Manual editin works greate on Andorid 2.3.6, 4.2.2 and 4.3. What version of Android are you using?

For you manual editing works where these lines are uncommented? https://github.com/VitaliiBlagodir/cordova-plugin-datepicker/blob/master/src/android/DatePickerPlugin.java#L111 https://github.com/VitaliiBlagodir/cordova-plugin-datepicker/blob/master/src/android/DatePickerPlugin.java#L148

bordeux commented 10 years ago

4.1.1 (tablet, prestigo) and 4.4.4 (sgs III with cyanogenmod ) -> i updated to new version and now i cant edit time/date with keyboard. here is my plugin def in config.xml

and here is video with my problem. https://www.youtube.com/watch?v=9OUS_E7py3A

Before 20 may, everythink works fine.

inazar commented 10 years ago

The problem is that plugin success callback is called on each keyboard press - multiple times. Result which is sent is '' - empty string which is converted by js to invalid date. Cordova on it's turn accepts the first callback and returns invalid date to the app.

After the js callback is called on first keyboard press (with invalid date) it is removed by cordova plugin package. So when you press 'Done' the correct date/time is collected and sent to the app BUT js callback is already removed and result is lost!!!

I've checked this with time picker, similar should happen with date picker.

Please, add the check in onTimeSet/onDateSet methods to check if the year/monthOfYear/dayOfMonth/hourOfDay/minute vars contain valid values before sending the success callback.

I'm using 4.4.3, mobile

OleksandrMuzyka commented 7 years ago

Please accept pull request with fix for this bug