Datetime - start display options


#1

I added date and time pickers to my app based on the ionic2 example. Works well with one flaw that I maybe am missing : how can I specify the date when the date picker shows up. Right now it always starts with 1/1/2016 . However, I would like it to start with the current date and go from there. Seems you can specify min and max dates only but not the start date when the picker shows up?


#2

Presumably your date picker is bound to some control or property in your component - initialize that to something like moment().toISOString().


#3

No,it’s not bound to anything.It plain html and has a ngmodel outlet.Any idea?


#4

This makes no sense to me. If it has [(ngModel)], it’s bound to that property.


#5

Ah, ok. The bound property is set to null initially. If it was a valid date would it show it then? I thought of it as the “return” value of the picker only, not to set the picker.


#6

Yes, worked. Thanks for the tip! You have to provide an ISO 8601 date string and all’s well.