Git Product home page Git Product logo

react-input-moment's Introduction

React date and time pickers powered by MomentJS.

This project is created from an older GitHub project by Prometheus Research. I wanted to add more functionality, but the other project was not being maintained and not being published to NPM so we created this repo.

Demo

A demo can be viewed here

Requirements

This module has peer dependencies: react, react-dom, and moment. These dependencies are not included in the build to reduce duplicate dependencies as a result of minor version differences. This allows for a flat dependency graph and should significantly reduce build size. Read More Here

Installation

  • npm install react react-dom moment --save
  • npm install react-input-moment --save
  • Go download input-moment.min.css and drop it as a css style link in your html page.

Sizing

As with many css components, getting them to look the way you want on all devices is not always so easy. These pickers are designed to stretch to their parent container element. The parent wrapper must have a set width and height.

Colors

If you want to override the default colors and use your own color scheme, see the scss in this file.

import {InputMoment, BigInputMoment, DatePicker, TimePicker} from 'react-input-moment';

//all wrapper classes should have a set width and height.
//percentages will work as long as the parent of the wrapper has a set width and height.

<div className="wrapper">
  <InputMoment
    moment={this.state.moment}
    onChange={this.handleChange}
    showSeconds={true}
    locale="en"
  />
</div>

<div className="wrapper">
  <BigInputMoment
    moment={this.state.moment}
    onChange={this.handleChange}
    locale="en"
  />
</div>

<div className="wrapper">
  <DatePicker
    moment={this.state.moment}
    onChange={this.handleChange}
    locale="en"
  />
</div>

//onChange(startMoment, endMoment)
<div className="wrapper">
  <DatePickerRange
    startMoment={this.state.startMoment}
    endMoment={this.state.endMoment}
    onChange={this.handleChange}
  />
</div>

<div className="wrapper">
  <TimePicker
    moment={this.state.moment}
    onChange={this.handleChange}
    showSeconds={true}
    locale="en"
  />
</div>

Check app.js for a working example.

Development

License

ISC

react-input-moment's People

Contributors

wayofthefuture avatar

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.