项目作者: shiv19

项目描述 :
Material Design Datetimepicker for Nativescript
高级语言: TypeScript
项目地址: git://github.com/shiv19/nativescript-material-datetimepicker.git
创建时间: 2017-10-14T13:57:25Z
项目社区:https://github.com/shiv19/nativescript-material-datetimepicker

开源协议:Apache License 2.0

下载


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

  1. tns plugin add nativescript-material-datetimepicker

Usage

NativeScript Core

  1. const MDTPicker = require("nativescript-material-datetimepicker").MaterialDatetimepicker;
  2. const mDtpicker = new MDTPicker();
  3. // Pick Date
  4. exports.selectDate = function() {
  5. mDtpicker.pickDate()
  6. .then((result) => {
  7. console.log("Date is: " + result.day + "-" + result.month + "-" + result.year);
  8. })
  9. .catch((error) => {
  10. console.log("Error: " + error);
  11. });
  12. };
  13. // Pick Time
  14. exports.selectTime = function() {
  15. mDtpicker.pickTime()
  16. .then((result) => {
  17. console.log("Time is: " + result.hour + ":" + result.minute);
  18. })
  19. .catch((error) => {
  20. console.log("Error: " + error);
  21. });
  22. };

API

pickDate(): Promise<{}>;

Returns a promise that resolves to date object

  1. date: {
  2. day: number,
  3. month: number,
  4. year: number
  5. }

pickTime(is24HourView?): Promise<{}>;

Returns a promise that resolves to time object

  1. time: {
  2. hour: number,
  3. minute: number
  4. }

Passing true to this API, shows a 24hr View timepicker.

License

Apache License Version 2.0, January 2004