smchae
smchae

Reputation: 1095

Ionic Datepicker and Timepicker

I am trying to build datepicker and timepicker components in my Ionic app for android.

I have looked for various libs and plugins, but I was not able to find what I wanted -- iOS style date and time picker which user can scroll to go through dates and times like image below.

enter image description here

Any advice and suggestion would be appreciated. Thank you in advance.

Upvotes: 1

Views: 2488

Answers (2)

Divyesh Savaliya
Divyesh Savaliya

Reputation: 2740

You can use drumjs javascript library.

You can easily create wheel with following code using this library.

<body class="outside">
    <select>
        <option>1</option>
        <option>2</option>
        ...
        <option selected>39</option>
        ...
        <option>5</option>
    </select>
    <script>
       $("select").drum();
    </script>
 </body>

see the example of datepicker like ios here

Upvotes: 0

Aditya Vyas-Lakhan
Aditya Vyas-Lakhan

Reputation: 13555

In Android it is called WheelPicker,I suggest you to use

WheelPicker

compile 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'

OUTPUT

enter image description here

OR

You can use CharacterPicker

CharacterPickerWindow mOptions = new CharacterPickerWindow(activity);

setPickerData(mOptions.getPickerView());

mOptions.setSelectOptions(0, 0, 0);

mOptions.setOnoptionsSelectListener(new OnOptionChangedListener() {
    @Override
    public void onOptionChanged(int options1, int option2, int options3) {

    }
});
mOptions.showAtLocation(v, Gravity.BOTTOM, 0, 0);

Upvotes: 1

Related Questions