Reputation: 1355
I have successfully created a new Cordova Windows Phone 8 Project using CLI.
I have also successfully added this Date time picker Plguin also, [Like it says on that page using CLI]
That plugin is for displaying native Date Time Picker on Textbox.
Now iam trying to invoke that plugin,
I tried,
<input type="Date" id="samp" />
<input type="datetime" id="samp" />
<input type="datetime-local" id="samp" />
etc.. in my code, but no native datetime picker is displaying in my app. Can somebody help me on this ??
Can somebody tell me how to invoke this Datetime Picker Plugin. ?
Upvotes: 3
Views: 1906
Reputation: 1
You can simply avoid using an "Input" tag to invoke datetimepicker picker. Why ?? Input tag will first invoke default keyboard on focus. Instead use a span or div tag.
Upvotes: 0
Reputation: 1355
I asked this question to the creator itself and he explained me how to do it.
There’s no detailed documentation (yet). Something like this would show the date picker when an element with class “date-input” is clicked (untested):
Eg: <input type="text" class="date-input" />
[you have to do something to avoid the soft keyboard, what about making it 'readonly'?]
$(".date-input").bind("click", function() {
datetimepicker.selectDate(function (date) {
console.log(date);
});
});
Once the date is selected, the callback function will log the selected date to the console, but you can do whatever with it.
The callback function will return a value. You have to parse it to get it in date format. This code would convert to a JavaScript date object:
date = new Date(parseInt(date, 10));
You can then format the date in any way you want.
Eg: <input type="text" class="time-input" />
[you have to do something to avoid the soft keyboard, what about making it 'readonly'?]
$(".time-input").bind("click", function() {
datetimepicker.selectTime(function (time) {
console.log(time);
});
});
Like that you can also use time too.
:-) Happy coding..!!
Upvotes: 3