Skip to content

Commit

Permalink
Fix bug that didn't allow showing datepicker twice
Browse files Browse the repository at this point in the history
When a datepicker was shown, the options date property value was changed to a string, If one tried to show again the datepicker it would throw an error, because we were trying to treat date as a Date object, and it is already a String (objects are mutable in Javascript).

So my solution was to check if the date attribute is a Date object, if so, change to string, if not, leave it as it is.
  • Loading branch information
davidaam committed Oct 30, 2015
1 parent e37f2b8 commit 473f1bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion www/android/DatePicker.js
Expand Up @@ -26,7 +26,7 @@ DatePicker.prototype.ANDROID_THEMES = {
*/
DatePicker.prototype.show = function(options, cb, errCb) {

if (options.date) {
if (options.date && options.date instanceof Date) {
options.date = (options.date.getMonth() + 1) + "/" +
(options.date.getDate()) + "/" +
(options.date.getFullYear()) + "/" +
Expand Down

0 comments on commit 473f1bd

Please sign in to comment.