IONIC2: Datepicker display bug when using min and max date that is in the past


#1

I noticed that the datepicker has a display bug. I’m using latest ionic2 version. When I create a blank profile and add a datepicker to a formbuilder form that captures a date like with day-month-year, the datepicker initially looks like this:

the month is not showing. I have to click where month should be to make it show. I used min and max date restrictions on the datepicker as this is for age check when signing up. so my maximum date is in the past (today - 18 years).


#2

Am I the only one experiencing this issue?


#3

To give some more info about this as I would definitely say this is a bug. When you give a min and max date that is in the past, the month does not show initially. You need to either have a max date that is after the next 1st of january or specify a default value that is in the range within your min and max date.

In my example I use the datepicker for dateOfBirth where the user needs to be at least 18 years old. So my max date is today - 18 years. The need for specify a default value is bad UX in this case, because the field should be blank until the user fills something in.


#4

No you are not, I am experiencing this issue as well. It’s quite annoying. In the meantime, I’m going to remove it and I am trying to create a workaround that displays and alert if the date chosen falls outside the range specified and prevents interaction. Might be worth doing as well since it is probably not high on the Ionic teams list.