From d4a1e8ceb1ad555cd5de8089706891d1de6e1cf7 Mon Sep 17 00:00:00 2001 From: Michael Katsevman Date: Wed, 8 Jul 2015 17:55:35 -0700 Subject: [PATCH 1/3] Added support for custom class names for the input item, and partial IE support --- DateTime.js | 8 +++++--- package.json | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/DateTime.js b/DateTime.js index c36c0efee..bc8941328 100644 --- a/DateTime.js +++ b/DateTime.js @@ -21,6 +21,7 @@ var Datetime = React.createClass({ time: TimeView }, propTypes: { + className: TYPES.string, date: TYPES.object, onBlur: TYPES.func, onChange: TYPES.func, @@ -36,6 +37,7 @@ var Datetime = React.createClass({ getDefaultProps: function() { return { + className: 'form-control', date: new Date(), viewMode: 'days', inputProps: {}, @@ -141,7 +143,7 @@ var Datetime = React.createClass({ ; return function( e ){ me.setState({ - viewDate: me.state.viewDate.clone()[ type ]( parseInt(e.target.dataset.value) ).startOf( type ), + viewDate: me.state.viewDate.clone()[ type ]( parseInt(e.target.getAttribute('data-value')) ).startOf( type ), currentView: nextViews[ type ] }); }; @@ -208,7 +210,7 @@ var Datetime = React.createClass({ date = this.state.viewDate.clone() .month( this.state.viewDate.month() + modifier ) - .date( parseInt( target.dataset.value ) ) + .date( parseInt( target.getAttribute('data-value') ) ) .hours( currentDate.hours() ) .minutes( currentDate.minutes() ) .seconds( currentDate.seconds() ) @@ -275,7 +277,7 @@ var Datetime = React.createClass({ children = [ DOM.input( assign({ key: 'i', type:'text', - className:'form-control', + className: this.props.className, onFocus: this.openCalendar, onChange: this.onChange, value: this.state.inputValue diff --git a/package.json b/package.json index c13927df7..7bdc267bb 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "author": "Javier Marquez", "license": "MIT", "peerDependencies": { - "react": ">=0.12", + "react": "0.13.2", "moment": ">=2.8.1" }, "devDependencies": { @@ -36,7 +36,7 @@ "gulp-insert": "^0.4.0", "gulp-uglify": "^1.2.0", "gulp-webpack": "^1.5.0", - "react": ">=0.12", + "react": "0.13.2", "react-tools": "^0.12.2", "webpack": "^1.5.1", "webpack-dev-server": "^1.7.0" From 3ab634eb5a3e460d16e1fab35f426b0ddc058683 Mon Sep 17 00:00:00 2001 From: Michael Katsevman Date: Thu, 9 Jul 2015 11:26:28 -0700 Subject: [PATCH 2/3] Added classlist-polyfill for older IE support --- DateTime.js | 2 ++ package.json | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/DateTime.js b/DateTime.js index bc8941328..df44c9720 100644 --- a/DateTime.js +++ b/DateTime.js @@ -1,5 +1,7 @@ 'use strict'; +require('classlist-polyfill'); + var assign = require('object-assign'), React = require('react'), DaysView = require('./src/DaysView'), diff --git a/package.json b/package.json index 7bdc267bb..6d0a360a2 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "react-datetime", - "version": "0.4.0", + "version": "0.4.3", "description": "A lightweight but complete datetime picker React.js component.", "homepage": "https://github.com/arqex/react-datetime", "repository": { "type": "git", "url": "https://github.com/arqex/react-datetime" }, - "main": "./lib/DateTime.jsx", + "main": "./DateTime.js", "scripts": { "build-npm": "jsx -x jsx ./src/ ./lib/", "build": "./node_modules/.bin/gulp.cmd", @@ -28,7 +28,7 @@ "author": "Javier Marquez", "license": "MIT", "peerDependencies": { - "react": "0.13.2", + "react": ">=0.12", "moment": ">=2.8.1" }, "devDependencies": { @@ -36,12 +36,13 @@ "gulp-insert": "^0.4.0", "gulp-uglify": "^1.2.0", "gulp-webpack": "^1.5.0", - "react": "0.13.2", + "react": ">=0.12", "react-tools": "^0.12.2", "webpack": "^1.5.1", "webpack-dev-server": "^1.7.0" }, "dependencies": { + "classlist-polyfill": "^1.0.1", "object-assign": "^3.0.0", "react-onclickoutside": "^0.2.4" } From 64f48e9eed7f78cd00fe31774df018b06a116cfe Mon Sep 17 00:00:00 2001 From: Michael Katsevman Date: Mon, 13 Jul 2015 13:57:49 -0700 Subject: [PATCH 3/3] Reverted classNames --- DateTime.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DateTime.js b/DateTime.js index df44c9720..cedabb42e 100644 --- a/DateTime.js +++ b/DateTime.js @@ -23,7 +23,6 @@ var Datetime = React.createClass({ time: TimeView }, propTypes: { - className: TYPES.string, date: TYPES.object, onBlur: TYPES.func, onChange: TYPES.func, @@ -279,7 +278,7 @@ var Datetime = React.createClass({ children = [ DOM.input( assign({ key: 'i', type:'text', - className: this.props.className, + className: 'form-control', onFocus: this.openCalendar, onChange: this.onChange, value: this.state.inputValue