Merge branch 'update-readme' of https://github.com/simeg/react-datetime into simeg-update-readme
| | |
| | | Usage |
| | | =============================== |
| | | |
| | | Installation : |
| | | Installation: |
| | | ``` |
| | | npm install react-datetime |
| | | npm install --save react-datetime |
| | | ``` |
| | | |
| | | [React.js](http://facebook.github.io/react/) and [Moment.js](http://momentjs.com/) are peer dependencies for react-datetime. These dependencies are not installed along with react-datetime automatically, but your project needs to have them installed in order to make the datetime picker work. |
| | |
| | | return <Datetime />; |
| | | } |
| | | ``` |
| | | [See this example working](http://codepen.io/arqex/pen/BoqgaG). |
| | | [See this example working](http://codepen.io/simeg/pen/mEmQmP). |
| | | |
| | | Don't forget to add the [CSS stylesheet](https://github.com/arqex/react-datetime/blob/master/css/react-datetime.css) to make it work out of the box. |
| | | **Don't forget to add the [CSS stylesheet](https://github.com/arqex/react-datetime/blob/master/css/react-datetime.css) to make it work out of the box.** |
| | | |
| | | Build the component (Mac / Linux): |
| | | ``` |
| | | npm run build:mac |
| | | ``` |
| | | |
| | | Build the component (Windows): |
| | | ``` |
| | | npm run build:windows |
| | | ``` |
| | | |
| | | API |
| | | =============================== |
| | |
| | | */ |
| | | |
| | | .rdt { |
| | | position: relative; |
| | | position: relative; |
| | | } |
| | | .rdtPicker { |
| | | display: none; |
| | | position: absolute; |
| | | display: none; |
| | | position: absolute; |
| | | width: 250px; |
| | | padding: 4px; |
| | | margin-top: 1px; |
| | |
| | | border: 1px solid #f9f9f9; |
| | | } |
| | | .rdtOpen .rdtPicker { |
| | | display: block; |
| | | display: block; |
| | | } |
| | | .rdtStatic .rdtPicker { |
| | | box-shadow: none; |
| | | position: static; |
| | | box-shadow: none; |
| | | position: static; |
| | | } |
| | | |
| | | .rdtPicker .rdtTimeToggle { |
| | | text-align: center; |
| | | text-align: center; |
| | | } |
| | | |
| | | .rdtPicker table { |
| | |
| | | cursor: not-allowed; |
| | | } |
| | | .rdtPicker th { |
| | | border-bottom: 1px solid #f9f9f9; |
| | | border-bottom: 1px solid #f9f9f9; |
| | | } |
| | | .rdtPicker .dow { |
| | | width: 14.2857%; |
| | |
| | | |
| | | .rdtPrev span, |
| | | .rdtNext span { |
| | | display: block; |
| | | -webkit-touch-callout: none; /* iOS Safari */ |
| | | display: block; |
| | | -webkit-touch-callout: none; /* iOS Safari */ |
| | | -webkit-user-select: none; /* Chrome/Safari/Opera */ |
| | | -khtml-user-select: none; /* Konqueror */ |
| | | -moz-user-select: none; /* Firefox */ |
| | |
| | | background: #eeeeee; |
| | | } |
| | | |
| | | .rdtPicker tfoot{ |
| | | border-top: 1px solid #f9f9f9; |
| | | .rdtPicker tfoot { |
| | | border-top: 1px solid #f9f9f9; |
| | | } |
| | | |
| | | .rdtPicker button { |
| | | border: none; |
| | | background: none; |
| | | cursor: pointer; |
| | | border: none; |
| | | background: none; |
| | | cursor: pointer; |
| | | } |
| | | .rdtPicker button:hover { |
| | | background-color: #eee; |
| | | background-color: #eee; |
| | | } |
| | | |
| | | .rdtPicker thead button { |
| | | width: 100%; |
| | | height: 100%; |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | |
| | | td.rdtMonth, |
| | | td.rdtYear { |
| | | height: 50px; |
| | | width: 25%; |
| | | cursor: pointer; |
| | | height: 50px; |
| | | width: 25%; |
| | | cursor: pointer; |
| | | } |
| | | td.rdtMonth:hover, |
| | | td.rdtYear:hover { |
| | | background: #eee; |
| | | background: #eee; |
| | | } |
| | | |
| | | .rdtCounters { |
| | | display: inline-block; |
| | | display: inline-block; |
| | | } |
| | | |
| | | .rdtCounters > div{ |
| | | float: left; |
| | | .rdtCounters > div { |
| | | float: left; |
| | | } |
| | | |
| | | .rdtCounter { |
| | | height: 100px; |
| | | height: 100px; |
| | | } |
| | | |
| | | .rdtCounter { |
| | | width: 40px; |
| | | width: 40px; |
| | | } |
| | | |
| | | .rdtCounterSeparator { |
| | | line-height: 100px; |
| | | line-height: 100px; |
| | | } |
| | | |
| | | .rdtCounter .rdtBtn { |
| | | height: 40%; |
| | | line-height: 40px; |
| | | cursor: pointer; |
| | | display: block; |
| | | height: 40%; |
| | | line-height: 40px; |
| | | cursor: pointer; |
| | | display: block; |
| | | |
| | | -webkit-touch-callout: none; /* iOS Safari */ |
| | | -webkit-touch-callout: none; /* iOS Safari */ |
| | | -webkit-user-select: none; /* Chrome/Safari/Opera */ |
| | | -khtml-user-select: none; /* Konqueror */ |
| | | -moz-user-select: none; /* Firefox */ |
| | |
| | | user-select: none; |
| | | } |
| | | .rdtCounter .rdtBtn:hover { |
| | | background: #eee; |
| | | background: #eee; |
| | | } |
| | | .rdtCounter .rdtCount { |
| | | height: 20%; |
| | | font-size: 1.2em; |
| | | height: 20%; |
| | | font-size: 1.2em; |
| | | } |
| | | |
| | | .rdtMilli { |
| | | vertical-align: middle; |
| | | padding-left: 8px; |
| | | width: 48px; |
| | | vertical-align: middle; |
| | | padding-left: 8px; |
| | | width: 48px; |
| | | } |
| | | |
| | | .rdtMilli input { |
| | | width: 100%; |
| | | font-size: 1.2em; |
| | | margin-top: 37px; |
| | | width: 100%; |
| | | font-size: 1.2em; |
| | | margin-top: 37px; |
| | | } |
| | | |
| | | .rdtDayPart { |
| | | margin-top: 43px; |
| | | margin-top: 43px; |
| | | } |
| | |
| | | var DateTime = require('../DateTime.js'); |
| | | var React = require('react'); |
| | | var ReactDOM = require('react-dom'); |
| | | |
| | | React.render( |
| | | ReactDOM.render( |
| | | React.createElement(DateTime, { timeFormat: true }), |
| | | document.getElementById('datetime') |
| | | ); |
| | |
| | | */ |
| | | |
| | | .rdt { |
| | | position: relative; |
| | | position: relative; |
| | | } |
| | | |
| | | .rdt > input { |
| | | border: 1px solid #000; |
| | | } |
| | | |
| | | .rdtPicker { |
| | | display: none; |
| | | position: absolute; |
| | | display: none; |
| | | position: absolute; |
| | | width: 250px; |
| | | padding: 4px; |
| | | margin-top: 1px; |
| | |
| | | border: 1px solid #f9f9f9; |
| | | } |
| | | .rdtOpen .rdtPicker { |
| | | display: block; |
| | | display: block; |
| | | } |
| | | .rdtStatic .rdtPicker { |
| | | box-shadow: none; |
| | | position: static; |
| | | box-shadow: none; |
| | | position: static; |
| | | } |
| | | |
| | | .rdtPicker .rdtTimeToggle { |
| | | text-align: center; |
| | | text-align: center; |
| | | } |
| | | |
| | | .rdtPicker table { |
| | |
| | | .rdtPicker th { |
| | | text-align: center; |
| | | height: 28px; |
| | | } |
| | | .rdtPicker td { |
| | | cursor: pointer; |
| | | } |
| | | .rdtPicker td.rdtToday:hover, |
| | | .rdtPicker td.rdtHour:hover, |
| | |
| | | cursor: not-allowed; |
| | | } |
| | | .rdtPicker th { |
| | | border-bottom: 1px solid #f9f9f9; |
| | | border-bottom: 1px solid #f9f9f9; |
| | | } |
| | | .rdtPicker .dow { |
| | | width: 14.2857%; |
| | |
| | | font-size: 21px; |
| | | vertical-align: top; |
| | | } |
| | | |
| | | .rdtPrev span, |
| | | .rdtNext span { |
| | | display: block; |
| | | -webkit-touch-callout: none; /* iOS Safari */ |
| | | -webkit-user-select: none; /* Chrome/Safari/Opera */ |
| | | -khtml-user-select: none; /* Konqueror */ |
| | | -moz-user-select: none; /* Firefox */ |
| | | -ms-user-select: none; /* Internet Explorer/Edge */ |
| | | user-select: none; |
| | | } |
| | | |
| | | .rdtPicker th.rdtDisabled, |
| | | .rdtPicker th.rdtDisabled:hover { |
| | | background: none; |
| | |
| | | background: #eeeeee; |
| | | } |
| | | |
| | | .rdtPicker tfoot{ |
| | | border-top: 1px solid #f9f9f9; |
| | | .rdtPicker tfoot { |
| | | border-top: 1px solid #f9f9f9; |
| | | } |
| | | |
| | | .rdtPicker button { |
| | | border: none; |
| | | background: none; |
| | | cursor: pointer; |
| | | border: none; |
| | | background: none; |
| | | cursor: pointer; |
| | | } |
| | | .rdtPicker button:hover { |
| | | background-color: #eee; |
| | | background-color: #eee; |
| | | } |
| | | |
| | | .rdtPicker thead button { |
| | | width: 100%; |
| | | height: 100%; |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | |
| | | td.rdtMonth, |
| | | td.rdtYear { |
| | | height: 50px; |
| | | width: 25%; |
| | | cursor: pointer; |
| | | height: 50px; |
| | | width: 25%; |
| | | cursor: pointer; |
| | | } |
| | | td.rdtMonth:hover, |
| | | td.rdtYear:hover { |
| | | background: #eee; |
| | | background: #eee; |
| | | } |
| | | |
| | | .rdtCounters { |
| | | display: inline-block; |
| | | display: inline-block; |
| | | } |
| | | |
| | | .rdtCounters > div{ |
| | | float: left; |
| | | .rdtCounters > div { |
| | | float: left; |
| | | } |
| | | |
| | | .rdtCounter { |
| | | height: 100px; |
| | | height: 100px; |
| | | } |
| | | |
| | | .rdtCounter { |
| | | width: 40px; |
| | | width: 40px; |
| | | } |
| | | |
| | | .rdtCounterSeparator { |
| | | line-height: 100px; |
| | | line-height: 100px; |
| | | } |
| | | |
| | | .rdtCounter .rdtBtn { |
| | | height: 40%; |
| | | line-height: 40px; |
| | | cursor: pointer; |
| | | height: 40%; |
| | | line-height: 40px; |
| | | cursor: pointer; |
| | | display: block; |
| | | |
| | | -webkit-touch-callout: none; /* iOS Safari */ |
| | | -webkit-user-select: none; /* Chrome/Safari/Opera */ |
| | | -khtml-user-select: none; /* Konqueror */ |
| | | -moz-user-select: none; /* Firefox */ |
| | | -ms-user-select: none; /* Internet Explorer/Edge */ |
| | | user-select: none; |
| | | } |
| | | .rdtCounter .rdtBtn:hover { |
| | | background: #eee; |
| | | background: #eee; |
| | | } |
| | | .rdtCounter .rdtCount { |
| | | height: 20%; |
| | | font-size: 1.2em; |
| | | height: 20%; |
| | | font-size: 1.2em; |
| | | } |
| | | |
| | | .rdtMilli { |
| | | vertical-align: middle; |
| | | padding-left: 8px; |
| | | width: 48px; |
| | | vertical-align: middle; |
| | | padding-left: 8px; |
| | | width: 48px; |
| | | } |
| | | |
| | | .rdtMilli input { |
| | | width: 100%; |
| | | font-size: 1.2em; |
| | | margin-top: 37px; |
| | | width: 100%; |
| | | font-size: 1.2em; |
| | | margin-top: 37px; |
| | | } |
| | | |
| | | .rdtDayPart { |
| | | margin-top: 43px; |
| | | } |
| | |
| | | }, |
| | | "main": "./DateTime.js", |
| | | "scripts": { |
| | | "build": "./node_modules/.bin/gulp.cmd", |
| | | "build:win": "./node_modules/.bin/gulp.cmd", |
| | | "build:mac": "./node_modules/.bin/gulp", |
| | | "test": "node node_modules/mocha/bin/mocha tests", |
| | | "dev": "webpack-dev-server --config example/webpack.config.js --devtool eval --progress --colors --hot --content-base example" |
| | | }, |