Forum Xamarin.iOS

Can't set min/max date in UIDatePicker

ArchitektArchitekt USMember ✭✭
edited March 2017 in Xamarin.iOS

I'm trying to set an upper and lower bound on my date picker and it doesn't work. I'm doing the following in my ViewDidLoad:

birthdate.MaximumDate = NSDate.Now;
birthdate.MinimumDate = NSDate.FromTimeIntervalSinceNow(-MIN_DATE_OFFSET_SECONDS); // 18 years in seconds
birthdate.SetDate(birthdate.MaximumDate, false);

Yet the date picker is letting me to go like 2037 and as far back as the 1800s. I don't understand why it's not working, it seems like a pretty straightforward thing to do.

Sign In or Register to comment.