Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@trendmicro/react-datepicker

Package Overview
Dependencies
Maintainers
4
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trendmicro/react-datepicker

React DatePicker Component

  • 1.0.0-alpha.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

react-datepicker build status Coverage Status

NPM

React DatePicker

image

Demo: https://trendmicro-frontend.github.io/react-datepicker

Installation

  1. Install the latest version of react, moment and react-datepicker:
npm install --save react moment @trendmicro/react-datepicker
  1. At this point you can import @trendmicro/react-datepicker and its styles in your application as follows:
import DatePicker, { DateInput, TimeInput } from '@trendmicro/react-datepicker';

// Be sure to include styles at some point, probably during your bootstraping
import '@trendmicro/react-datepicker/dist/react-datepicker.css';

Usage

DatePicker

Initialize state in your React component:

state = {
    date: moment().format('YYYY-MM-DD')
};
Controlled
<DatePicker
    date={this.state.date}
    onSelect={date => {
        this.setState(state => ({ date: date }));
    }}
/>
Uncontrolled
<DatePicker
    defaultDate={this.state.date}
    onSelect={date => {
        // Optional
    }}
/>

DateInput

Initialize state in your React component:

state = {
    // 2017-08-01
    value: moment().format('YYYY-MM-DD')
};
Controlled
<DateInput
    value={this.state.value}
    onChange={value => {
        this.setState(state => ({ value: value }));
    }}
/>
Uncontrolled
<DateInput
    defaultValue={this.state.value}
    onChange={value => {
        // Optional
    }}
/>

TimeInput

Initialize state in your React component:

state = {
    // 08:00:00
    value: moment().format('hh:mm:ss')
};
Controlled
<TimeInput
    value={this.state.value}
    onChange={value => {
        this.setState(state => ({ value: value }));
    }}
/>
Uncontrolled
<TimeInput
    defaultValue={this.state.value}
    onChange={value => {
        // Optional
    }}
/>

Examples

DatePicker

image

Sources

DateTimePicker

image

Sources

DateTimeRangePicker

image

Sources

API

Properties

DatePicker
NameTypeDefaultDescription
localestring'en'
dateobject or stringnull
defaultDateobject or stringnull
minDateobject or stringnullThe minimum selectable date. When set to null, there is no minimum.
maxDateobject or stringnullThe maximum selectable date. When set to null, there is no maximum.
onSelectfunction(date)Called when a date is selected.
DateInput
NameTypeDefaultDescription
valueobject or stringnull
defaultValueobject or stringnull
minDateobject or stringnullThe minimum date. When set to null, there is no minimum.
maxDateobject or stringnullThe maximum date. When set to null, there is no maximum.
onChangefunction(value)Called when the value changes.
TimeInput
NameTypeDefaultDescription
valuestring'00:00:00'
defaultValuestring'00:00:00'
onChangefunction(value)Called when the value changes.

License

MIT

Keywords

FAQs

Package last updated on 22 Apr 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc