cordova-plugin-datepicker
cordova-plugin-datepicker copied to clipboard
iOS CANCEL button renders date now
when clicking the 'cancel' button on iOS it should just cancel the whole action and return nothing, but it returns the date/time of now.
on android the cancel button works as it is supposed to, just happens on iOS. any ideas?
pickDate() { this.datePicker.show({ date: new Date(), mode: 'date', okText: 'Save', allowOldDates: false, androidTheme: this.datePicker.ANDROID_THEMES.THEME_HOLO_LIGHT }).then((date) => { const dateObject = { dueDate: date, dateOnly: true }; this.viewCtrl.dismiss(dateObject); }).catch((err) => { console.log('Error occurred while getting date: ', err); }); }
I am having the same issue. Did you ever find a workaround?
Try following workaround:
this.datePicker.show(pickerOptions).then(
date => {
if (date === undefined) { return; };
console.log('Got date: ', date);
},
err => console.log('Error occurred while getting date: ', err)
);