Can't find a way to make a good date input


#1

I need to let the user set a date. I have a date picker working but the problem I’m having is with the interface.

The options I was able to find was:

  1. use ion-input with [(ngModel)] to bind with the variable, but with that I can’t find a way to format the date (I want to format dd/mm/yyyy) in the interface and I also can’t find a way to disable the manual input (the input must be only by the date picker).
  2. use ion-label with {{registerDate | date: "dd"}}/{{registerDate | date: "MM"}}/{{registerDate | date: "yyyy"}} to format the date, but I can’t find a way to bind it with the variable, so it’s not being updated after setting the date with the date picker.

Does anyone knows a good solution?


#2

I think I’ll just leave this right here…

http://blog.ionic.io/ionic-2-fixing-date-inputs-for-the-mobile-web/


#3

I saw that, but I can’t make it work. The [(ngModel)], like it says to use, throws an exception No value accessor for '' when used on anything that is not an ion-input.


#4

Hmm, I haven’t seen this before.

https://github.com/driftyco/ionic-preview-app/tree/master/app/pages/datetime/basic

In the demos for the component docs and API docs, there haven’t been any errors