1.0.9 • Published 7 years ago

nativescript-material-datetimepicker v1.0.9

Weekly downloads
6
License
Apache-2.0
Repository
github
Last release
7 years ago

nativescript-material-datetimepicker Build Status npm npm

Twitter URL

NPM

This plugin is a wrapper around android.app.DatePickerDialog for Android.


DEPRECATED - 25th Oct 2017

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.

  • Shiv19

Screenshots

Date Picker

Time Picker

Installation

tns plugin add nativescript-material-datetimepicker

Usage

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);
        });
};

API

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.

License

Apache License Version 2.0, January 2004