Datapicker Componet in Ionic2


#1

Is there a datapicker picker component in ionic2, I tried to use the datepicker as given in the ionic docs here: http://ionicframework.com/docs/v2/native/Date%20Picker/.

I did the following steps:

  1. Installed the datepicker cordova plugin: cordova plugin add cordova-plugin-datepicker

  2. Added the following code:

`import {DatePicker} from ‘ionic-native’;

DatePicker.show({
date: new Date(),
mode: ‘date’
}).then(
date => console.log("Seleted date is: ", date),
err => console.log(“Error occurred while getting date:”, err)
);`

I get the error as ‘Module DatePicker not found’. How to install and configure this datepicker plugin? Can I install it via npm? Please help.


#2

the native datepicker doesn’t work on browser.

Try on device self, it should appear.


#3

When I try to import Datepicker i get the error as ‘Module not found’.

import {DatePicker} from ‘ionic-native’ So where to find the datepicker module. Have done the installation correctly? Is there any documentation on installing it?


#4

Ok got it! I need to add the ionic-native module, I added it using npm install ionic-native, Now the datepicker works!!

The datepicker is bit old fashioned doesn’t show up the material design one or the ios 9 version

It shows something like this: http://i.imgur.com/0PBFGLQ.png

Should I update any plugins here? I update cordova-android to 5.0.0 though.


#5

I don’t think so, I have the same old fashioned design and I am sure to have all updated.


#6

Thanks! for the clarification, helped me.