date-time-selector

React / Bootstrap 4 Date Time Selector


Keywords
bootstrap, bootstrap-4, bootstrap4, datepicker, datetime-picker, datetimepicker, momentjs, react, react-component
License
MIT
Install
npm install date-time-selector@1.0.33

Documentation

date-time-selector

A(nother) date time selector.

This one...

  • Is a React Component.
  • Makes use of out-of-the-box Bootstrap 4 css classes for styling.
  • Uses icons from fontawesome

All internal date manipulation is achieved using Moment.js

The component renders an input-group

Demo

https://codesandbox.io/s/881mmkvlwl

Getting Started

Install

npm

npm add date-time-selector

yarn

yarn add date-time-selector

Usage

Import

import DateTimeSelector from 'date-time-selector'

JSX

<DateTimeSelector>

<DateTimeSelector onSelected={this.handleSelected} disableTime={true} format='L' default={moment()} />

Props

Prop Type Required Description Default
default Object A moment.js object. This will be the default value selected in the selector
onSelected Function Will be called when a date is submitted. The selected moment is the only argument. Can be null.
format String moment.js format string. 'L LTS'
disableTime Boolean Set it to true if you'd like to hide the time inputs. false