Giter Site home page Giter Site logo

capawesome-team / capacitor-datetime-picker Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 0.0 262 KB

⚡️ Capacitor plugin that let the user easily enter both a date and a time.

Home Page: https://capawesome.io/plugins/datetime-picker/

License: MIT License

Ruby 1.99% Java 34.43% Swift 53.54% Objective-C 1.38% JavaScript 0.97% TypeScript 7.70%
android capacitor capacitor-community ios capacitor-plugin capacitor-android capawesome capacitor-ios datepicker datetime timepicker

capacitor-datetime-picker's Introduction

⚠️ Deprecated repository

This project has been moved to the following monorepo: capawesome-team/capacitor-plugins.



Datetime Picker

@capawesome-team/capacitor-datetime-picker

Capacitor plugin that let the user easily enter both a date and a time.


Maintainers

Maintainer GitHub Social
Robin Genz robingenz @robin_genz

Demo

A working example can be found here: robingenz/capacitor-plugin-demo

Android iOS

Installation

If you are an Insider, see Getting started with Insiders and follow the instructions to install the plugin.

If you are not an Insider, please install the package from the public npm registry:

npm install @capawesome-team/capacitor-datetime-picker
npx cap sync

Configuration

No configuration required for this plugin.

Usage

import { DatetimePicker } from '@capawesome-team/capacitor-datetime-picker';

const present = async () => {
  const date = new Date('1995-12-24T02:23:00');

  const { value } = DatetimePicker.present({
    cancelButtonText: 'Cancel',
    doneButtonText: 'Ok',
    mode: 'time',
    value: date.toISOString(),
    theme: 'dark',
    locale: 'en-US',
  });

  return value;
};

API

present(...)

present(options?: PresentOptions | undefined) => Promise<PresentResult>

Open the datetime picker.

An error is thrown if the input is canceled or dismissed by the user.

Only available for Android and iOS.

Param Type
options PresentOptions

Returns: Promise<PresentResult>

Since: 0.0.1


Interfaces

PresentResult

Prop Type Description Since
value string The value entered by the user. The format of this value matches the value of the format parameter. 0.0.1

PresentOptions

Prop Type Description Default Since
cancelButtonText string The cancel button text. 'Cancel' 0.0.1
doneButtonText string The done button text. 'Ok' 0.0.1
format string The format in which values are received and returned. 'yyyy-MM-dd'T'HH:mm:ss.sss'Z'' 0.0.1
locale string BCP 47 language tag to define the language of the UI. 0.0.2
max string The latest date and time to accept. The format of this value must match the value of the format parameter. This value must specify a date string later than or equal to the one specified by the min attribute. 0.0.1
min string The earliest date and time to accept. The format of this value must match the value of the format parameter. This value must specify a date string earlier than or equal to the one specified by the max attribute. 0.0.1
mode 'date' | 'time' | 'datetime' Whether you want a date or time or datetime picker. 'datetime' 0.0.1
theme 'auto' | 'light' | 'dark' Choose the theme that the datetime picker should have. With auto the system theme is used. This value overwrites the theme configuration value. Only available for Android and iOS. 0.0.1
value string The predefined value when opening the picker. The format of this value must match the value of the format parameter. 0.0.1

Credits

The iOS implementation of this plugin is based on RPicker which is licensed under MIT.

Changelog

See CHANGELOG.md.

License

See LICENSE.

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.