Material Design Datetimepicker for Nativescript
This plugin is a wrapper around android.app.DatePickerDialog
for Android.
All functionality of this plugin, and more (including iOS Support), is now
available at nativescript-modal-datetimepicker <3
Use this plugin, only if you don’t need iOS support, and other additional features.
Be warned, development of this plugin has been discontinued.
tns plugin add nativescript-material-datetimepicker
NativeScript Core
const MDTPicker = require("nativescript-material-datetimepicker").MaterialDatetimepicker;
const mDtpicker = new MDTPicker();
// Pick Date
exports.selectDate = function() {
mDtpicker.pickDate()
.then((result) => {
console.log("Date is: " + result.day + "-" + result.month + "-" + result.year);
})
.catch((error) => {
console.log("Error: " + error);
});
};
// Pick Time
exports.selectTime = function() {
mDtpicker.pickTime()
.then((result) => {
console.log("Time is: " + result.hour + ":" + result.minute);
})
.catch((error) => {
console.log("Error: " + error);
});
};
pickDate(): Promise<{}>;
Returns a promise that resolves to date object
date: {
day: number,
month: number,
year: number
}
pickTime(is24HourView?): Promise<{}>;
Returns a promise that resolves to time object
time: {
hour: number,
minute: number
}
Passing true
to this API, shows a 24hr View timepicker.
Apache License Version 2.0, January 2004