Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datepicker sometimes showing multiple "Today" entries #294

Open
jondspa opened this issue Dec 10, 2020 · 1 comment
Open

Datepicker sometimes showing multiple "Today" entries #294

jondspa opened this issue Dec 10, 2020 · 1 comment

Comments

@jondspa
Copy link

jondspa commented Dec 10, 2020

Thanks for the great plugin!

I've been using it for years on iOS and Android. Lately I've seen a little trouble on iOS (not sure about Android). Every once in a while, after opening the datepicker, as I scroll near the current date, I see "Today" appearing on different days, usually near the current date. I do not see the multiple today's at the same time - sometimes it's correct on the current date, sometimes it's a day or two in the past. Any ideas?

I'm calling the plugin with these options:

 options = {
    date: myDate,
    mode: 'datetime',
    minuteInterval: 5,
    x: 400,
    y: 600
 };

myDate is either the current date or a date in the past.

I've checked multiple times during the day and don't find any hints to the problem.

Running
datepicker 0.9.3
cordova 9.0.0
cordova ios 4.2.1

Testing on an iOS device running 13.6.1.

Thanks!

  • Jon
@jondspa
Copy link
Author

jondspa commented Aug 15, 2022

Here's more information and a possible solution. I found this discussion:
https://stackoverflow.com/questions/48392577/refresh-internal-state-of-ios-uidatepicker-after-midnight

Note that the problem is not with the plugin but a problem inside Apple's UIDatePicker. To hopefully fix this I've commented out a few lines in the iOS version of DataPicker.m - below lines 1,3,4,5 commented out. This hopefully will force the plugin to regenerate the data picker every time. (showForPad is not used!)

Hope this helps someone!

  • Jon

(top of showForPhone)
//if(!self.datePickerContainer){
[[NSBundle mainBundle] loadNibNamed:@"DatePicker" owner:self options:nil];
//} else {
// self.datePickerContainer.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
//}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant