Git Product home page Git Product logo

cordova-plugin-datetimepicker's Introduction

npm version

Cordova Plugin DateTimePicker

Native date and time picker for Android.

Installation

cordova plugins add cordova-plugin-datetimepicker --save

Usage

var options = {
    type: 'date',         // 'date' or 'time', required
    date: new Date(),     // date or timestamp, default: current date
    minDate: new Date(),  // date or timestamp
    maxDate: new Date()   // date or timestamp
};

window.DateTimePicker.pick(options, function (timestamp) {
    window.alert(timestamp);
});

Screenshots

The following screenshots were made on a device with Android 6.0. The plugin uses the default styles of the device it's running on.

Date Picker Time Picker

Development

# uninstall old version if present
cordova plugins remove cordova-plugin-datetimepicker

# by using --link the Java files are updated instantly (doesn't work for JavaScript)
cordova plugins add --link ../cordova-plugin-datetimepicker

cordova run android --device

cordova-plugin-datetimepicker's People

Contributors

alex-pl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cordova-plugin-datetimepicker's Issues

Can't set below 1970 Year as mindate

Can't set below 1970 Year as mindate please advice

var minDateAndroid = parseInt(d.getFullYear())-50 +"-" +("0"+(parseInt(d.getMonth())+1)).slice(-2)+"-"+("0"+(parseInt(d.getDate()))).slice(-2);

var options = {
type: 'date', // 'date' or 'time', required
date: new Date(selectedDateAndroid), // date or timestamp, default: current date
minDate: new Date(minDateAndroid).getTime(), // date or timestamp
maxDate: new Date(maxDateAndroid).getTime() // date or timestamp
};

window.DateTimePicker.pick(options, function (timestamp) {
})

Make date property optional

The date property should be optional. When there is no date given, use the current date as default value.

Publish on npm

Publish the plugin on npm to support appropriate versioning.

Add license file

Currently the license is just mentioned in package.json. Make the license more discoverable by creating a dedicated LICENSE file (plain text).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.