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

the-react-datetime-picker

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

the-react-datetime-picker

The only react datepicker that really works on desktop and mobile with a neat UX concept.

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by400%
Maintainers
1
Weekly downloads
 
Created
Source

The only React Datetime Picker you need

I tried a lot of datepickers and all had some drawbacks that really annoyed me or made it hard for the users to pick a date on either desktop or mobile. So I went out to create a datepicker using a UX pattern, that is not really usual, but that allows for nice selection of time and which I quite like, I first saw in a Angular datepicker (which is that one here: https://dalelotts.github.io/angular-bootstrap-datetimepicker/).

Features

In this datepicker you first choose a year, than a month, than a hour and then a minute. So you go from less to more granular specification of your date object. But you can also choose to use the typical calendar (Day) view and go back and forth through the months.

Further features are:

  • Easy selection of date and time (it is a datetime picker ;-))
  • Choosing a min and max Date that is marked as selectable
  • You can theme it to adapt to your design
  • Using react as peer-dependency (you probably already have it anyhow in your bundle)
  • and some selected date-fns methods and no other dependencies (only selected methods are used to minimize bundle size)

Installation

Using npm:

npm install --save the-react-datetime-picker

and using yarn:

yarn add the-react-datetime-picker

Usage

The minimalist usage example would be something like this:

import DatetimePicker from 'the-react-datetime-picker'

<DatetimePicker onChange={ (newDate) => console.log(newDate) } />

Using the picker will call onChange whenever the user picked a date or changes a date and the given callback will be called with an instance of Date.

Further examples can be views in the example.js and all available options can be views in the following section:

API (Props)

These are the properties you can use to configure the Datetime Picker:

nametypedescriptiondefaultoptional?
themeObjectAn optional object specifying styling choices, to make it your ownyes
inputPropsObjectProperties to pass to the rendered input fieldyes
selectedDateDateThe date and time that is preselected in the datetime picker.new Date()yes
onChangeFunction(Date)Callback that is called, whenever the value changesyes
placeholderStringText to show within the input field, whenever there is not yet a date pickedyes
resultFormatStringFormat of Date to show within the input field, whenever there is a date picked. Because there is no dependency used, you can only use these symbols to create a date output, right now: Y, M, D, H, m'YYYY-MM-DD HH:mm'yes
initialViewStringDefines which view will be shown initially. Possible values are: Years, Months, Days, Hours, Minutes'Years'yes
minDateIf defined, all dates and times before this one, are marked as outOfRange.yes
maxDateIf defined, all dates and times after this one, are marked as outOfRange.yes

Issues

If you find any issues, please add them into our tracker: https://github.com/HeuteTanzen/the-react-datetime-picker/issues.

Development

We also except Pull Requests. So feel free to code. But to enhance the chances for your PR to be merged, please give a heads up, before you start hacking so we know what's coming. Also feel free to look into the issues on GitHub to see what's planned (labeled with backlog).

We use Babel through Webpack and yarn for installind and locking the dependencies.

Licence

It's MIT licences. So feel free to use.

Keywords

FAQs

Package last updated on 15 Nov 2017

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