You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@capawesome-team/capacitor-datetime-picker

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capawesome-team/capacitor-datetime-picker

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

7.0.1
latest
Source
npmnpm
Version published
Weekly downloads
484
-12%
Maintainers
1
Weekly downloads
 
Created
Source

@capawesome-team/capacitor-datetime-picker

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

Installation

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

Configuration

No configuration required for this plugin.

Demo

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

AndroidiOS

Usage

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

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

  const { value } = await 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 on Android and iOS.

ParamType
optionsPresentOptions

Returns: Promise<PresentResult>

Since: 0.0.1

Interfaces

PresentResult

PropTypeDescriptionSince
valuestringThe value entered by the user. The format of this value matches the value of the format parameter.0.0.1

PresentOptions

PropTypeDescriptionDefaultSince
cancelButtonTextstringThe cancel button text.'Cancel'0.0.1
doneButtonTextstringThe done button text.'Ok'0.0.1
formatstringThe format in which values are received and returned.'yyyy-MM-dd'T'HH:mm:ss.sss'Z''0.0.1
localestringBCP 47 language tag to define the language of the UI.0.0.2
maxstringThe 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
minstringThe 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 on Android and iOS. Spinner options only available on Android0.0.1
valuestringThe predefined value when opening the picker. The format of this value must match the value of the format parameter.0.0.1
androidTimePickerMode'clock' | 'spinner'Whether to use the spinner or clock mode for the time picker on Android. This value overwrites the androidTimePickerMode configuration value. Only available on Android.5.1.0
androidDatePickerMode'spinner' | 'calendar'Whether to use the calendar or spinner mode for the date picker on Android. This value overwrites the androidDatePickerMode configuration value. Only available on Android.5.1.0

Credits

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

Changelog

See CHANGELOG.md.

License

See LICENSE.

Keywords

capacitor

FAQs

Package last updated on 01 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts