Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic 2 datetime-local minute step 30 min

I have a datetime-local input box in my ionic 2 app but I want to show the minutes in 30 min interval only, that is only 0 or 30 (like 9.00 or 9.30). I read about steps but could not find for minutes. Is there a way to achieve it ?

like image 670
Missak Boyajian Avatar asked Sep 08 '16 21:09

Missak Boyajian


People also ask

How to display the date and time in an ionic picker?

The picker then displays scrollable columns that can be used to individually select years, months, days, hours and minute values. The DateTime component is similar to the native <input type="datetime-local"> element, however, Ionic's DateTime component makes it easy to display the date and time in a preferred format, and manage the datetime values.

What is datetime in ionic?

Datetimes are similar to the native input elements of type datetime-local, however, Ionic's Datetime component makes it easy to display the date and time in a preferred format, and manage the datetime values.

What is yyyy-mm-ddThh MMZ in ionic?

ISO 8601 Datetime Format: YYYY-MM-DDTHH:mmZ Ionic uses the ISO 8601 datetime format for its value. The value is simply a string, rather than using JavaScript's Date object. Using the ISO datetime format makes it easy to serialize and parse within JSON objects and databases.

How to set upper or lower limit for selection in ion-datepicker?

We only need to add min & max properties on the ion-datepicker directive to set an upper or lower limit for selection The [pickerOptions] property can take a configuration object to customize the button text and add a custom function handler In the above code, we added a template reference #mydt to set values to the [ (ngModel)]


1 Answers

You should be able to achieve this with setting a attribute minuteValues to your input like this:

<ion-datetime displayFormat="HH:mm" [(ngModel)]="myDate" minuteValues="0,30">

The minuteValues can be an array of numbers or a string of comma separated numbers.

EDIT:

Based on comment. ion-datetime directive is not available in Ionic 1.x but can be used in Ionic 2.x. For Ionic 1.x you can use a plugin like ion-datetime-picker

like image 94
thepio Avatar answered Oct 07 '22 03:10

thepio