Ionic-framework: Set ion-datetetime min max values from function call as compared from a string value in the html?

Created on 14 Jun 2016  路  3Comments  路  Source: ionic-team/ionic-framework

How do I dynamically set the min max datetime values (including date and time values). I'm hoping the ion-datetime to call in a function, which returns the acceptable time value as a string.

Can this be done in beta.8 or future versions?

Most helpful comment

You can use property binding to bind the min/max to an expression. Something like this:

<ion-datetime [min]="myMinDate" [max]="myMaxDate"></ion-datetime>

See the Angular property binding documentation for more info: https://angular.io/docs/ts/latest/guide/template-syntax.html#!#property-binding

Thanks!

All 3 comments

You can use property binding to bind the min/max to an expression. Something like this:

<ion-datetime [min]="myMinDate" [max]="myMaxDate"></ion-datetime>

See the Angular property binding documentation for more info: https://angular.io/docs/ts/latest/guide/template-syntax.html#!#property-binding

Thanks!

Thanks, can we also restrict the time or only date value?

Right now only the date, but there is an open issue to include time: https://github.com/driftyco/ionic/issues/6850

Was this page helpful?
0 / 5 - 0 ratings