marquex
2015-07-10 d3f4b340beeb6093d31b6be02b671fe05f62b50e
Bumps to v0.5.0
1 files deleted
3 files modified
47 ■■■■ changed files
dist/react-datetime.js 6 ●●●● patch | view | raw | blame | history
dist/react-datetime.min.js 4 ●●●● patch | view | raw | blame | history
karma.dev.js 28 ●●●●● patch | view | raw | blame | history
package.json 9 ●●●● patch | view | raw | blame | history
dist/react-datetime.js
@@ -1,5 +1,5 @@
/*
react-datetime v0.4.3
react-datetime v0.5.0
https://github.com/arqex/react-datetime
MIT: https://github.com/arqex/react-datetime/raw/master/LICENSE
*/
@@ -59,7 +59,7 @@
/* 0 */
/***/ function(module, exports, __webpack_require__) {
    eval("'use strict';\r\n\r\nvar assign = __webpack_require__(3),\r\n\tReact = __webpack_require__(2),\r\n\tDaysView = __webpack_require__(4),\r\n\tMonthsView = __webpack_require__(6),\r\n\tYearsView = __webpack_require__(1),\r\n\tTimeView = __webpack_require__(7),\r\n\tmoment = __webpack_require__(5)\r\n;\r\n\r\nvar TYPES = React.PropTypes;\r\nvar Datetime = React.createClass({\r\n\tmixins: [\r\n\t\t__webpack_require__(8)\r\n\t],\r\n\tviewComponents: {\r\n\t\tdays: DaysView,\r\n\t\tmonths: MonthsView,\r\n\t\tyears: YearsView,\r\n\t\ttime: TimeView\r\n\t},\r\n\tpropTypes: {\r\n\t\tdate: TYPES.object,\r\n\t\tonBlur: TYPES.func,\r\n\t\tonChange: TYPES.func,\r\n\t\tlocale: TYPES.string,\r\n\t\tinput: TYPES.bool,\r\n\t\tdateFormat: TYPES.string,\r\n\t\ttimeFormat: TYPES.string,\r\n\t\tinputProps: TYPES.object,\r\n\t\tviewMode: TYPES.oneOf(['years', 'months', 'days', 'time']),\r\n\t\tminDate: TYPES.object,\r\n\t\tmaxDate: TYPES.object\r\n\t},\r\n\tgetDefaultProps: function() {\r\n\r\n\t\treturn {\r\n\t\t\tdate: new Date(),\r\n\t\t\tviewMode: 'days',\r\n\t\t\tinputProps: {},\r\n\t\t\tinput: true,\r\n\t\t\tonBlur: function () {},\r\n\t\t\tonChange: function (x) {\r\n\t\t\t\tconsole.log(x);\r\n\t\t\t}\r\n\t\t};\r\n\t},\r\n\tgetInitialState: function() {\r\n\t\tvar formats = this.getFormats( this.props ),\r\n\t\t\tdate = this.props.date\r\n\t\t;\r\n\t\treturn {\r\n\t\t\tcurrentView: this.props.viewMode,\r\n\t\t\topen: !this.props.input,\r\n\t\t\tinputFormat: formats.datetime,\r\n\t\t\tviewDate: this.localMoment(date).startOf(\"month\"),\r\n\t\t\tselectedDate: this.localMoment(date),\r\n\t\t\tinputValue: this.localMoment(date).format( formats.datetime )\r\n\t\t};\r\n\t},\r\n\r\n\tgetFormats: function( props ){\r\n\t\tvar formats = {\r\n\t\t\t\tdate: '',\r\n\t\t\t\ttime: '',\r\n\t\t\t\tdatetime: ''\r\n\t\t\t},\r\n\t\t\tlocale = this.localMoment( props.date ).localeData()\r\n\t\t;\r\n\r\n\t\tif( props.dateFormat ){\r\n\t\t\tformats.date = props.dateFormat;\r\n\t\t}\r\n\t\tif( props.timeFormat ){\r\n\t\t\tformats.time = props.timeFormat;\r\n\t\t}\r\n\r\n\t\tif( !formats.date && !formats.time ){\r\n\t\t\tformats.date = locale.longDateFormat('L');\r\n\t\t\tformats.time = locale.longDateFormat('LT');\r\n\t\t\tformats.datetime = formats.date + ' ' + formats.time;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif( props.dateFormat ){\r\n\t\t\t\tformats.date = props.dateFormat;\r\n\t\t\t\tformats.datetime = formats.date;\r\n\t\t\t}\r\n\t\t\tif( props.timeFormat ){\r\n\t\t\t\tif( formats.date )\r\n\t\t\t\t\tformats.datetime += ' ';\r\n\t\t\t\tformats.time = props.timeFormat;\r\n\t\t\t\tformats.datetime += formats.time;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn formats;\r\n\t},\r\n\r\n\tcomponentWillReceiveProps: function(nextProps) {\r\n\t\tvar formats = this.getFormats( nextProps );\r\n\t\tif ( formats.datetime !== this.getFormats(this.props).datetime ) {\r\n\t\t\treturn this.setState({\r\n\t\t\t\tinputFormat: nextProps.inputFormat\r\n\t\t\t});\r\n\t\t}\r\n\t},\r\n\r\n\tonChange: function(event) {\r\n\t\tvar value = event.target == null ? event : event.target.value,\r\n\t\t\tlocalMoment = this.localMoment( date )\r\n\t\t;\r\n\r\n\t\tif (localMoment.isValid()) {\r\n\t\t\tthis.setState({\r\n\t\t\t\tselectedDate: localMoment,\r\n\t\t\t\tviewDate: localMoment.clone().startOf(\"month\")\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn this.setState({\r\n\t\t\tinputValue: value\r\n\t\t}, function() {\r\n\t\t\treturn this.props.onChange( localMoment.toDate() );\r\n\t\t});\r\n\t},\r\n\r\n\tshowView: function( view ){\r\n\t\tvar me = this;\r\n\t\treturn function( e ){\r\n\t\t\tme.setState({ currentView: view });\r\n\t\t};\r\n\t},\r\n\r\n\tsetDate: function( type ){\r\n\t\tvar me = this,\r\n\t\t\tnextViews = {\r\n\t\t\t\tmonth: 'days',\r\n\t\t\t\tyear: 'months'\r\n\t\t\t}\r\n\t\t;\r\n\t\treturn function( e ){\r\n\t\t\tme.setState({\r\n\t\t\t\tviewDate: me.state.viewDate.clone()[ type ]( parseInt(e.target.dataset.value) ).startOf( type ),\r\n\t\t\t\tcurrentView: nextViews[ type ]\r\n\t\t\t});\r\n\t\t};\r\n\t},\r\n\r\n\taddTime: function( amount, type, toSelected ){\r\n\t\treturn this.updateTime( 'add', amount, type, toSelected );\r\n\t},\r\n\r\n\tsubtractTime: function( amount, type, toSelected ){\r\n\t\treturn this.updateTime( 'subtract', amount, type, toSelected );\r\n\t},\r\n\r\n\tupdateTime: function( op, amount, type, toSelected ){\r\n\t\tvar me = this;\r\n\r\n\t\treturn function(){\r\n\t\t\tvar update = {},\r\n\t\t\t\tdate = toSelected ? 'selectedDate' : 'viewDate'\r\n\t\t\t;\r\n\r\n\t\t\tupdate[ date ] = me.state[ date ].clone()[ op ]( amount, type );\r\n\r\n\t\t\tme.setState( update );\r\n\t\t};\r\n\t},\r\n\r\n\tallowedSetTime: ['hours','minutes','seconds', 'milliseconds'],\r\n\tsetTime: function( type, value ){\r\n\t\tvar index = this.allowedSetTime.indexOf( type ) + 1,\r\n\t\t\tdate = this.state.selectedDate.clone(),\r\n\t\t\tnextType\r\n\t\t;\r\n\r\n\t\t// It is needed to set all the time properties\r\n\t\t// to not to reset the time\r\n\t\tdate[ type ]( value );\r\n\t\tfor (; index < this.allowedSetTime.length; index++) {\r\n\t\t\tnextType = this.allowedSetTime[index];\r\n\t\t\tdate[ nextType ]( date[nextType]() );\r\n\t\t}\r\n\r\n\t\tthis.setState({\r\n\t\t\tselectedDate: date,\r\n\t\t\tinputValue: date.format( this.state.inputFormat )\r\n\t\t}, this.callOnChange );\r\n\t},\r\n\r\n\tcallOnChange: function(){\r\n\t\tthis.props.onChange(this.state.selectedDate.format( this.state.inputFormat ));\r\n\t},\r\n\r\n\tupdateDate: function( e ) {\r\n\t\tvar target = e.target,\r\n\t\t\tmodifier = 0,\r\n\t\t\tcurrentDate = this.state.selectedDate,\r\n\t\t\tdate\r\n\t\t;\r\n\r\n\t\tif(target.className.indexOf(\"new\") != -1)\r\n\t\t\tmodifier = 1;\r\n\t\telse if(target.className.indexOf(\"old\") != -1)\r\n\t\t\tmodifier = -1;\r\n\r\n\t\tdate = this.state.viewDate.clone()\r\n\t\t\t.month( this.state.viewDate.month() + modifier )\r\n\t\t\t.date( parseInt( target.dataset.value ) )\r\n\t\t\t.hours( currentDate.hours() )\r\n\t\t\t.minutes( currentDate.minutes() )\r\n\t\t\t.seconds( currentDate.seconds() )\r\n\t\t\t.milliseconds( currentDate.milliseconds() )\r\n\t\t;\r\n\r\n\t\tthis.setState({\r\n\t\t\tselectedDate: date,\r\n\t\t\tviewDate: date.clone().startOf('month'),\r\n\t\t\tinputValue: date.format( this.state.inputFormat )\r\n\t\t}, this.callOnChange );\r\n\t},\r\n\r\n\topenCalendar: function() {\r\n\t\tthis.setState({ open: true });\r\n\t},\r\n\r\n\thandleClickOutside: function(){\r\n\t\tthis.props.onBlur(this.state.inputValue);\r\n\t\tif( this.props.input && this.state.open )\r\n\t\t\tthis.setState({ open: false });\r\n\t},\r\n\r\n\tlocalMoment: function( date ){\r\n\t\tvar m = moment( date );\r\n\t\tif( this.props.locale )\r\n\t\t\tm.locale( this.props.locale );\r\n\t\treturn m;\r\n\t},\r\n\r\n\tcomponentProps: {\r\n\t\tfromProps: ['viewMode', 'minDate', 'maxDate', 'renderDay', 'renderMonth', 'renderYear'],\r\n\t\tfromState: ['viewDate', 'selectedDate' ],\r\n\t\tfromThis: ['setDate', 'setTime', 'showView', 'addTime', 'subtractTime', 'updateDate', 'localMoment']\r\n\t},\r\n\r\n\tgetComponentProps: function(){\r\n\t\tvar me = this,\r\n\t\t\tformats = this.getFormats( this.props ),\r\n\t\t\tprops = {dateFormat: formats.date, timeFormat: formats.time}\r\n\t\t;\r\n\r\n\t\tthis.componentProps.fromProps.forEach( function( name ){\r\n\t\t\tprops[ name ] = me.props[ name ];\r\n\t\t});\r\n\t\tthis.componentProps.fromState.forEach( function( name ){\r\n\t\t\tprops[ name ] = me.state[ name ];\r\n\t\t});\r\n\t\tthis.componentProps.fromThis.forEach( function( name ){\r\n\t\t\tprops[ name ] = me[ name ];\r\n\t\t});\r\n\r\n\t\treturn props;\r\n\t},\r\n\r\n\trender: function() {\r\n\t\tvar Component = this.viewComponents[ this.state.currentView ],\r\n\t\t\tDOM = React.DOM,\r\n\t\t\tclassName = 'rdt',\r\n\t\t\tchildren = []\r\n\t\t;\r\n\r\n\t\tif( this.props.input ){\r\n\t\t\tchildren = [ DOM.input( assign({\r\n\t\t\t\tkey: 'i',\r\n\t\t\t\ttype:'text',\r\n\t\t\t\tclassName:'form-control',\r\n\t\t\t\tonFocus: this.openCalendar,\r\n\t\t\t\tonChange: this.onChange,\r\n\t\t\t\tvalue: this.state.inputValue\r\n\t\t\t}, this.props.inputProps ))];\r\n\t\t}\r\n\t\telse {\r\n\t\t\tclassName += ' rdtStatic';\r\n\t\t}\r\n\r\n\t\tif( this.state.open )\r\n\t\t\tclassName += ' rdtOpen';\r\n\r\n\t\treturn DOM.div({className: className}, children.concat(\r\n\t\t\tDOM.div(\r\n\t\t\t\t{ key: 'dt', className: 'rdtPicker' },\r\n\t\t\t\tReact.createElement( Component, this.getComponentProps())\r\n\t\t\t)\r\n\t\t));\r\n\t}\r\n});\r\n\r\nmodule.exports = Datetime;\r\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./Datetime.js\n ** module id = 0\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./Datetime.js?");
    eval("'use strict';\r\n\r\nvar assign = __webpack_require__(3),\r\n\tReact = __webpack_require__(2),\r\n\tDaysView = __webpack_require__(4),\r\n\tMonthsView = __webpack_require__(6),\r\n\tYearsView = __webpack_require__(1),\r\n\tTimeView = __webpack_require__(7),\r\n\tmoment = __webpack_require__(5)\r\n;\r\n\r\nvar TYPES = React.PropTypes;\r\nvar Datetime = React.createClass({\r\n\tmixins: [\r\n\t\t__webpack_require__(8)\r\n\t],\r\n\tviewComponents: {\r\n\t\tdays: DaysView,\r\n\t\tmonths: MonthsView,\r\n\t\tyears: YearsView,\r\n\t\ttime: TimeView\r\n\t},\r\n\tpropTypes: {\r\n\t\tdate: TYPES.object,\r\n\t\tonBlur: TYPES.func,\r\n\t\tonChange: TYPES.func,\r\n\t\tlocale: TYPES.string,\r\n\t\tinput: TYPES.bool,\r\n\t\tdateFormat: TYPES.string,\r\n\t\ttimeFormat: TYPES.string,\r\n\t\tinputProps: TYPES.object,\r\n\t\tviewMode: TYPES.oneOf(['years', 'months', 'days', 'time']),\r\n\t\tminDate: TYPES.object,\r\n\t\tmaxDate: TYPES.object\r\n\t},\r\n\tgetDefaultProps: function() {\r\n\t\tvar nof = function(){};\r\n\t\treturn {\r\n\t\t\tdate: new Date(),\r\n\t\t\tviewMode: 'days',\r\n\t\t\tinputProps: {},\r\n\t\t\tinput: true,\r\n\t\t\tonBlur: nof,\r\n\t\t\tonChange: nof\r\n\t\t};\r\n\t},\r\n\tgetInitialState: function() {\r\n\t\tvar formats = this.getFormats( this.props ),\r\n\t\t\tdate = this.props.date\r\n\t\t;\r\n\t\treturn {\r\n\t\t\tcurrentView: this.props.viewMode,\r\n\t\t\topen: !this.props.input,\r\n\t\t\tinputFormat: formats.datetime,\r\n\t\t\tviewDate: this.localMoment(date).startOf(\"month\"),\r\n\t\t\tselectedDate: this.localMoment(date),\r\n\t\t\tinputValue: this.localMoment(date).format( formats.datetime )\r\n\t\t};\r\n\t},\r\n\r\n\tgetFormats: function( props ){\r\n\t\tvar formats = {\r\n\t\t\t\tdate: '',\r\n\t\t\t\ttime: '',\r\n\t\t\t\tdatetime: ''\r\n\t\t\t},\r\n\t\t\tlocale = this.localMoment( props.date ).localeData()\r\n\t\t;\r\n\r\n\t\tif( props.dateFormat ){\r\n\t\t\tformats.date = props.dateFormat;\r\n\t\t}\r\n\t\tif( props.timeFormat ){\r\n\t\t\tformats.time = props.timeFormat;\r\n\t\t}\r\n\r\n\t\tif( !formats.date && !formats.time ){\r\n\t\t\tformats.date = locale.longDateFormat('L');\r\n\t\t\tformats.time = locale.longDateFormat('LT');\r\n\t\t\tformats.datetime = formats.date + ' ' + formats.time;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif( props.dateFormat ){\r\n\t\t\t\tformats.date = props.dateFormat;\r\n\t\t\t\tformats.datetime = formats.date;\r\n\t\t\t}\r\n\t\t\tif( props.timeFormat ){\r\n\t\t\t\tif( formats.date )\r\n\t\t\t\t\tformats.datetime += ' ';\r\n\t\t\t\tformats.time = props.timeFormat;\r\n\t\t\t\tformats.datetime += formats.time;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn formats;\r\n\t},\r\n\r\n\tcomponentWillReceiveProps: function(nextProps) {\r\n\t\tvar formats = this.getFormats( nextProps );\r\n\t\tif ( formats.datetime !== this.getFormats(this.props).datetime ) {\r\n\t\t\treturn this.setState({\r\n\t\t\t\tinputFormat: nextProps.inputFormat\r\n\t\t\t});\r\n\t\t}\r\n\t},\r\n\r\n\tonChange: function(event) {\r\n\t\tvar value = event.target == null ? event : event.target.value,\r\n\t\t\tlocalMoment = this.localMoment( date )\r\n\t\t;\r\n\r\n\t\tif (localMoment.isValid()) {\r\n\t\t\tthis.setState({\r\n\t\t\t\tselectedDate: localMoment,\r\n\t\t\t\tviewDate: localMoment.clone().startOf(\"month\")\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn this.setState({\r\n\t\t\tinputValue: value\r\n\t\t}, function() {\r\n\t\t\treturn this.props.onChange( localMoment.toDate() );\r\n\t\t});\r\n\t},\r\n\r\n\tshowView: function( view ){\r\n\t\tvar me = this;\r\n\t\treturn function( e ){\r\n\t\t\tme.setState({ currentView: view });\r\n\t\t};\r\n\t},\r\n\r\n\tsetDate: function( type ){\r\n\t\tvar me = this,\r\n\t\t\tnextViews = {\r\n\t\t\t\tmonth: 'days',\r\n\t\t\t\tyear: 'months'\r\n\t\t\t}\r\n\t\t;\r\n\t\treturn function( e ){\r\n\t\t\tme.setState({\r\n\t\t\t\tviewDate: me.state.viewDate.clone()[ type ]( parseInt(e.target.dataset.value) ).startOf( type ),\r\n\t\t\t\tcurrentView: nextViews[ type ]\r\n\t\t\t});\r\n\t\t};\r\n\t},\r\n\r\n\taddTime: function( amount, type, toSelected ){\r\n\t\treturn this.updateTime( 'add', amount, type, toSelected );\r\n\t},\r\n\r\n\tsubtractTime: function( amount, type, toSelected ){\r\n\t\treturn this.updateTime( 'subtract', amount, type, toSelected );\r\n\t},\r\n\r\n\tupdateTime: function( op, amount, type, toSelected ){\r\n\t\tvar me = this;\r\n\r\n\t\treturn function(){\r\n\t\t\tvar update = {},\r\n\t\t\t\tdate = toSelected ? 'selectedDate' : 'viewDate'\r\n\t\t\t;\r\n\r\n\t\t\tupdate[ date ] = me.state[ date ].clone()[ op ]( amount, type );\r\n\r\n\t\t\tme.setState( update );\r\n\t\t};\r\n\t},\r\n\r\n\tallowedSetTime: ['hours','minutes','seconds', 'milliseconds'],\r\n\tsetTime: function( type, value ){\r\n\t\tvar index = this.allowedSetTime.indexOf( type ) + 1,\r\n\t\t\tdate = this.state.selectedDate.clone(),\r\n\t\t\tnextType\r\n\t\t;\r\n\r\n\t\t// It is needed to set all the time properties\r\n\t\t// to not to reset the time\r\n\t\tdate[ type ]( value );\r\n\t\tfor (; index < this.allowedSetTime.length; index++) {\r\n\t\t\tnextType = this.allowedSetTime[index];\r\n\t\t\tdate[ nextType ]( date[nextType]() );\r\n\t\t}\r\n\r\n\t\tthis.setState({\r\n\t\t\tselectedDate: date,\r\n\t\t\tinputValue: date.format( this.state.inputFormat )\r\n\t\t});\r\n\r\n\t\tthis.props.onChange( date );\r\n\t},\r\n\r\n\tupdateDate: function( e ) {\r\n\t\tvar target = e.target,\r\n\t\t\tmodifier = 0,\r\n\t\t\tcurrentDate = this.state.selectedDate,\r\n\t\t\tdate\r\n\t\t;\r\n\r\n\t\tif(target.className.indexOf(\"new\") != -1)\r\n\t\t\tmodifier = 1;\r\n\t\telse if(target.className.indexOf(\"old\") != -1)\r\n\t\t\tmodifier = -1;\r\n\r\n\t\tdate = this.state.viewDate.clone()\r\n\t\t\t.month( this.state.viewDate.month() + modifier )\r\n\t\t\t.date( parseInt( target.dataset.value ) )\r\n\t\t\t.hours( currentDate.hours() )\r\n\t\t\t.minutes( currentDate.minutes() )\r\n\t\t\t.seconds( currentDate.seconds() )\r\n\t\t\t.milliseconds( currentDate.milliseconds() )\r\n\t\t;\r\n\r\n\t\tthis.setState({\r\n\t\t\tselectedDate: date,\r\n\t\t\tviewDate: date.clone().startOf('month'),\r\n\t\t\tinputValue: date.format( this.state.inputFormat )\r\n\t\t});\r\n\r\n\t\tthis.props.onChange( date );\r\n\t},\r\n\r\n\topenCalendar: function() {\r\n\t\tthis.setState({ open: true });\r\n\t},\r\n\r\n\thandleClickOutside: function(){\r\n\t\tthis.props.onBlur( this.state.selectedDate );\r\n\t\tif( this.props.input && this.state.open )\r\n\t\t\tthis.setState({ open: false });\r\n\t},\r\n\r\n\tlocalMoment: function( date ){\r\n\t\tvar m = moment( date );\r\n\t\tif( this.props.locale )\r\n\t\t\tm.locale( this.props.locale );\r\n\t\treturn m;\r\n\t},\r\n\r\n\tcomponentProps: {\r\n\t\tfromProps: ['viewMode', 'minDate', 'maxDate', 'renderDay', 'renderMonth', 'renderYear'],\r\n\t\tfromState: ['viewDate', 'selectedDate' ],\r\n\t\tfromThis: ['setDate', 'setTime', 'showView', 'addTime', 'subtractTime', 'updateDate', 'localMoment']\r\n\t},\r\n\r\n\tgetComponentProps: function(){\r\n\t\tvar me = this,\r\n\t\t\tformats = this.getFormats( this.props ),\r\n\t\t\tprops = {dateFormat: formats.date, timeFormat: formats.time}\r\n\t\t;\r\n\r\n\t\tthis.componentProps.fromProps.forEach( function( name ){\r\n\t\t\tprops[ name ] = me.props[ name ];\r\n\t\t});\r\n\t\tthis.componentProps.fromState.forEach( function( name ){\r\n\t\t\tprops[ name ] = me.state[ name ];\r\n\t\t});\r\n\t\tthis.componentProps.fromThis.forEach( function( name ){\r\n\t\t\tprops[ name ] = me[ name ];\r\n\t\t});\r\n\r\n\t\treturn props;\r\n\t},\r\n\r\n\trender: function() {\r\n\t\tvar Component = this.viewComponents[ this.state.currentView ],\r\n\t\t\tDOM = React.DOM,\r\n\t\t\tclassName = 'rdt',\r\n\t\t\tchildren = []\r\n\t\t;\r\n\r\n\t\tif( this.props.input ){\r\n\t\t\tchildren = [ DOM.input( assign({\r\n\t\t\t\tkey: 'i',\r\n\t\t\t\ttype:'text',\r\n\t\t\t\tclassName:'form-control',\r\n\t\t\t\tonFocus: this.openCalendar,\r\n\t\t\t\tonChange: this.onChange,\r\n\t\t\t\tvalue: this.state.inputValue\r\n\t\t\t}, this.props.inputProps ))];\r\n\t\t}\r\n\t\telse {\r\n\t\t\tclassName += ' rdtStatic';\r\n\t\t}\r\n\r\n\t\tif( this.state.open )\r\n\t\t\tclassName += ' rdtOpen';\r\n\r\n\t\treturn DOM.div({className: className}, children.concat(\r\n\t\t\tDOM.div(\r\n\t\t\t\t{ key: 'dt', className: 'rdtPicker' },\r\n\t\t\t\tReact.createElement( Component, this.getComponentProps())\r\n\t\t\t)\r\n\t\t));\r\n\t}\r\n});\r\n\r\nmodule.exports = Datetime;\r\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./Datetime.js\n ** module id = 0\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./Datetime.js?");
/***/ },
/* 1 */
@@ -101,7 +101,7 @@
/* 7 */
/***/ function(module, exports, __webpack_require__) {
    eval("'use strict';\r\n\r\nvar React = __webpack_require__(2);\r\n\r\nvar DOM = React.DOM;\r\nvar DateTimePickerTime = React.createClass({\r\n\tgetInitialState: function(){\r\n\t\tvar date = this.props.selectedDate,\r\n\t\t\tformat = this.props.timeFormat,\r\n\t\t\tcounters = []\r\n\t\t;\r\n\r\n\t\tif( format.indexOf('H') != -1 || format.indexOf('h') != -1 ){\r\n\t\t\tcounters.push('hours');\r\n\t\t\tif( format.indexOf('m') != -1 ){\r\n\t\t\t\tcounters.push('minutes');\r\n\t\t\t\tif( format.indexOf('s') != -1 ){\r\n\t\t\t\t\tcounters.push('seconds');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\thours: date.format('H'),\r\n\t\t\tminutes: date.format('mm'),\r\n\t\t\tseconds: date.format('ss'),\r\n\t\t\tmilliseconds: date.format('SSS'),\r\n\t\t\tcounters: counters\r\n\t\t};\r\n\t},\r\n\trenderCounter: function( type ){\r\n\t\treturn DOM.div({ key: type, className: 'rdtCounter'}, [\r\n\t\t\tDOM.button({ key:'up', className: 'btn', onMouseDown: this.onStartClicking( 'increase', type ) }, '▲' ),\r\n\t\t\tDOM.div({ key:'c', className: 'rdtCount' }, this.state[ type ] ),\r\n\t\t\tDOM.button({ key:'do', className: 'btn', onMouseDown: this.onStartClicking( 'decrease', type ) }, '▼' )\r\n\t\t]);\r\n\t},\r\n\trender: function() {\r\n\t\tvar me = this,\r\n\t\t\tcounters = []\r\n\t\t;\r\n\r\n\t\tthis.state.counters.forEach( function(c){\r\n\t\t\tif( counters.length )\r\n\t\t\t\tcounters.push( DOM.div( {key: 'sep' + counters.length, className: 'rdtCounterSeparator' }, ':' ));\r\n\t\t\tcounters.push( me.renderCounter( c ) );\r\n\t\t});\r\n\r\n\t\tif( this.state.counters.length == 3 && this.props.timeFormat.indexOf('S') != -1 ){\r\n\t\t\tcounters.push( DOM.div( {className: 'rdtCounterSeparator', key: 'sep5' }, ':' ));\r\n\t\t\tcounters.push(\r\n\t\t\t\tDOM.div( {className: 'rdtCounter rdtMilli', key:'m'},\r\n\t\t\t\t\tDOM.input({ value: this.state.milliseconds, type: 'text', onChange: this.updateMilli })\r\n\t\t\t\t\t)\r\n\t\t\t\t);\r\n\t\t}\r\n\r\n\t\treturn DOM.div( {className: 'rdtTime'},\r\n\t\t\tDOM.table( {}, [\r\n\t\t\t\tthis.renderHeader(),\r\n\t\t\t\tDOM.tbody({key: 'b'}, DOM.tr({}, DOM.td({},\r\n\t\t\t\t\tDOM.div({ className: 'rdtCounters' }, counters )\r\n\t\t\t\t)))\r\n\t\t\t])\r\n\t\t);\r\n\r\n\t},\r\n\tupdateMilli: function( e ){\r\n\t\tvar milli = parseInt( e.target.value );\r\n\t\tif( milli == e.target.value && milli >= 0 && milli < 1000 ){\r\n\t\t\tthis.props.setTime( 'milliseconds', milli );\r\n\t\t\tthis.setState({ milliseconds: milli });\r\n\t\t}\r\n\t},\r\n\trenderHeader: function(){\r\n\t\tif( !this.props.dateFormat )\r\n\t\t\treturn '';\r\n\r\n\t\treturn DOM.thead({ key: 'h'}, DOM.tr({},\r\n\t\t\tDOM.th( {colSpan: 4, onClick: this.props.showView('days')}, this.props.selectedDate.format( this.props.dateFormat ) )\r\n\t\t));\r\n\t},\r\n\tonStartClicking: function( action, type ){\r\n\t\tvar me = this,\r\n\t\t\tupdate = {}\r\n\t\t;\r\n\t\treturn function(){\r\n\t\t\tvar update = {};\r\n\t\t\tupdate[ type ] = me[ action ]( type );\r\n\t\t\tme.setState( update );\r\n\r\n\t\t\tme.timer = setTimeout( function(){\r\n\t\t\t\tme.increaseTimer = setInterval( function(){\r\n\t\t\t\t\tupdate[ type ] = me[ action ]( type );\r\n\t\t\t\t\tme.setState( update );\r\n\t\t\t\t},80);\r\n\t\t\t}, 500);\r\n\r\n\t\t\tdocument.body.addEventListener('mouseup', function(){\r\n\t\t\t\tclearTimeout( me.timer );\r\n\t\t\t\tclearInterval( me.increaseTimer );\r\n\t\t\t\tme.props.setTime( type, me.state[ type ] );\r\n\t\t\t});\r\n\t\t};\r\n\t},\r\n\r\n\tmaxValues: {\r\n\t\thours: 23,\r\n\t\tminutes: 59,\r\n\t\tseconds: 59,\r\n\t\tmilliseconds: 999\r\n\t},\r\n\tpadValues: {\r\n\t\thours: 1,\r\n\t\tminutes: 2,\r\n\t\tseconds: 2,\r\n\t\tmilliseconds: 3\r\n\t},\r\n\tincrease: function( type ){\r\n\t\tvar value = parseInt(this.state[ type ]) + 1;\r\n\t\tif( value > this.maxValues[ type ] )\r\n\t\t\tvalue = 0;\r\n\t\treturn this.pad( type, value );\r\n\t},\r\n\tdecrease: function( type ){\r\n\t\tvar value = parseInt(this.state[ type ]) - 1;\r\n\t\tif( value < 0 )\r\n\t\t\tvalue = this.maxValues[ type ];\r\n\t\treturn this.pad( type, value );\r\n\t},\r\n\tpad: function( type, value ){\r\n\t\tvar str = value + '';\r\n\t\twhile( str.length < this.padValues[ type ] )\r\n\t\t\tstr = '0' + str;\r\n\t\treturn str;\r\n\t}\r\n});\r\n\r\nmodule.exports = DateTimePickerTime;\r\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/TimeView.js\n ** module id = 7\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/TimeView.js?");
    eval("'use strict';\r\n\r\nvar React = __webpack_require__(2);\r\n\r\nvar DOM = React.DOM;\r\nvar DateTimePickerTime = React.createClass({\r\n\tgetInitialState: function(){\r\n\t\tvar date = this.props.selectedDate,\r\n\t\t\tformat = this.props.timeFormat,\r\n\t\t\tcounters = []\r\n\t\t;\r\n\r\n\t\tif( format.indexOf('H') != -1 || format.indexOf('h') != -1 ){\r\n\t\t\tcounters.push('hours');\r\n\t\t\tif( format.indexOf('m') != -1 ){\r\n\t\t\t\tcounters.push('minutes');\r\n\t\t\t\tif( format.indexOf('s') != -1 ){\r\n\t\t\t\t\tcounters.push('seconds');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\thours: date.format('H'),\r\n\t\t\tminutes: date.format('mm'),\r\n\t\t\tseconds: date.format('ss'),\r\n\t\t\tmilliseconds: date.format('SSS'),\r\n\t\t\tcounters: counters\r\n\t\t};\r\n\t},\r\n\trenderCounter: function( type ){\r\n\t\treturn DOM.div({ key: type, className: 'rdtCounter'}, [\r\n\t\t\tDOM.button({ key:'up', className: 'btn', onMouseDown: this.onStartClicking( 'increase', type ) }, '▲' ),\r\n\t\t\tDOM.div({ key:'c', className: 'rdtCount' }, this.state[ type ] ),\r\n\t\t\tDOM.button({ key:'do', className: 'btn', onMouseDown: this.onStartClicking( 'decrease', type ) }, '▼' )\r\n\t\t]);\r\n\t},\r\n\trender: function() {\r\n\t\tvar me = this,\r\n\t\t\tcounters = []\r\n\t\t;\r\n\r\n\t\tthis.state.counters.forEach( function(c){\r\n\t\t\tif( counters.length )\r\n\t\t\t\tcounters.push( DOM.div( {key: 'sep' + counters.length, className: 'rdtCounterSeparator' }, ':' ));\r\n\t\t\tcounters.push( me.renderCounter( c ) );\r\n\t\t});\r\n\r\n\t\tif( this.state.counters.length == 3 && this.props.timeFormat.indexOf('S') != -1 ){\r\n\t\t\tcounters.push( DOM.div( {className: 'rdtCounterSeparator', key: 'sep5' }, ':' ));\r\n\t\t\tcounters.push(\r\n\t\t\t\tDOM.div( {className: 'rdtCounter rdtMilli', key:'m'},\r\n\t\t\t\t\tDOM.input({ value: this.state.milliseconds, type: 'text', onChange: this.updateMilli })\r\n\t\t\t\t\t)\r\n\t\t\t\t);\r\n\t\t}\r\n\r\n\t\treturn DOM.div( {className: 'rdtTime'},\r\n\t\t\tDOM.table( {}, [\r\n\t\t\t\tthis.renderHeader(),\r\n\t\t\t\tDOM.tbody({key: 'b'}, DOM.tr({}, DOM.td({},\r\n\t\t\t\t\tDOM.div({ className: 'rdtCounters' }, counters )\r\n\t\t\t\t)))\r\n\t\t\t])\r\n\t\t);\r\n\r\n\t},\r\n\tupdateMilli: function( e ){\r\n\t\tvar milli = parseInt( e.target.value );\r\n\t\tif( milli == e.target.value && milli >= 0 && milli < 1000 ){\r\n\t\t\tthis.props.setTime( 'milliseconds', milli );\r\n\t\t\tthis.setState({ milliseconds: milli });\r\n\t\t}\r\n\t},\r\n\trenderHeader: function(){\r\n\t\tif( !this.props.dateFormat )\r\n\t\t\treturn '';\r\n\r\n\t\treturn DOM.thead({ key: 'h'}, DOM.tr({},\r\n\t\t\tDOM.th( {colSpan: 4, onClick: this.props.showView('days')}, this.props.selectedDate.format( this.props.dateFormat ) )\r\n\t\t));\r\n\t},\r\n\tonStartClicking: function( action, type ){\r\n\t\tvar me = this,\r\n\t\t\tupdate = {}\r\n\t\t;\r\n\t\treturn function(){\r\n\t\t\tvar update = {};\r\n\t\t\tupdate[ type ] = me[ action ]( type );\r\n\t\t\tme.setState( update );\r\n\r\n\t\t\tme.timer = setTimeout( function(){\r\n\t\t\t\tme.increaseTimer = setInterval( function(){\r\n\t\t\t\t\tupdate[ type ] = me[ action ]( type );\r\n\t\t\t\t\tme.setState( update );\r\n\t\t\t\t},80);\r\n\t\t\t}, 500);\r\n\r\n\t\t\tme.mouseUpListener = function(){\r\n\t\t\t\tclearTimeout( me.timer );\r\n\t\t\t\tclearInterval( me.increaseTimer );\r\n\t\t\t\tme.props.setTime( type, me.state[ type ] );\r\n\t\t\t\tdocument.body.removeEventListener('mouseup', me.mouseUpListener);\r\n\t\t\t};\r\n\r\n\t\t\tdocument.body.addEventListener('mouseup', me.mouseUpListener);\r\n\t\t};\r\n\t},\r\n\r\n\tmaxValues: {\r\n\t\thours: 23,\r\n\t\tminutes: 59,\r\n\t\tseconds: 59,\r\n\t\tmilliseconds: 999\r\n\t},\r\n\tpadValues: {\r\n\t\thours: 1,\r\n\t\tminutes: 2,\r\n\t\tseconds: 2,\r\n\t\tmilliseconds: 3\r\n\t},\r\n\tincrease: function( type ){\r\n\t\tvar value = parseInt(this.state[ type ]) + 1;\r\n\t\tif( value > this.maxValues[ type ] )\r\n\t\t\tvalue = 0;\r\n\t\treturn this.pad( type, value );\r\n\t},\r\n\tdecrease: function( type ){\r\n\t\tvar value = parseInt(this.state[ type ]) - 1;\r\n\t\tif( value < 0 )\r\n\t\t\tvalue = this.maxValues[ type ];\r\n\t\treturn this.pad( type, value );\r\n\t},\r\n\tpad: function( type, value ){\r\n\t\tvar str = value + '';\r\n\t\twhile( str.length < this.padValues[ type ] )\r\n\t\t\tstr = '0' + str;\r\n\t\treturn str;\r\n\t}\r\n});\r\n\r\nmodule.exports = DateTimePickerTime;\r\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/TimeView.js\n ** module id = 7\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/TimeView.js?");
/***/ },
/* 8 */
dist/react-datetime.min.js
@@ -1,6 +1,6 @@
/*
react-datetime v0.4.3
react-datetime v0.5.0
https://github.com/arqex/react-datetime
MIT: https://github.com/arqex/react-datetime/raw/master/LICENSE
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require(void 0),require(void 0)):"function"==typeof define&&define.amd?define([,],e):"object"==typeof exports?exports.Datetime=e(require(void 0),require(void 0)):t.Datetime=e(t.React,t.moment)}(this,function(t,e){return function(t){function e(n){if(s[n])return s[n].exports;var a=s[n]={exports:{},id:n,loaded:!1};return t[n].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var s={};return e.m=t,e.c=s,e.p="",e(0)}([function(t,e,s){"use strict";var n=s(3),a=s(2),r=s(4),o=s(6),i=s(1),c=s(7),u=s(5),d=a.PropTypes,l=a.createClass({mixins:[s(8)],viewComponents:{days:r,months:o,years:i,time:c},propTypes:{date:d.object,onBlur:d.func,onChange:d.func,locale:d.string,input:d.bool,dateFormat:d.string,timeFormat:d.string,inputProps:d.object,viewMode:d.oneOf(["years","months","days","time"]),minDate:d.object,maxDate:d.object},getDefaultProps:function(){return{date:new Date,viewMode:"days",inputProps:{},input:!0,onBlur:function(){},onChange:function(t){console.log(t)}}},getInitialState:function(){var t=this.getFormats(this.props),e=this.props.date;return{currentView:this.props.viewMode,open:!this.props.input,inputFormat:t.datetime,viewDate:this.localMoment(e).startOf("month"),selectedDate:this.localMoment(e),inputValue:this.localMoment(e).format(t.datetime)}},getFormats:function(t){var e={date:"",time:"",datetime:""},s=this.localMoment(t.date).localeData();return t.dateFormat&&(e.date=t.dateFormat),t.timeFormat&&(e.time=t.timeFormat),e.date||e.time?(t.dateFormat&&(e.date=t.dateFormat,e.datetime=e.date),t.timeFormat&&(e.date&&(e.datetime+=" "),e.time=t.timeFormat,e.datetime+=e.time)):(e.date=s.longDateFormat("L"),e.time=s.longDateFormat("LT"),e.datetime=e.date+" "+e.time),e},componentWillReceiveProps:function(t){var e=this.getFormats(t);return e.datetime!==this.getFormats(this.props).datetime?this.setState({inputFormat:t.inputFormat}):void 0},onChange:function(t){var e=null==t.target?t:t.target.value,s=this.localMoment(date);return s.isValid()&&this.setState({selectedDate:s,viewDate:s.clone().startOf("month")}),this.setState({inputValue:e},function(){return this.props.onChange(s.toDate())})},showView:function(t){var e=this;return function(s){e.setState({currentView:t})}},setDate:function(t){var e=this,s={month:"days",year:"months"};return function(n){e.setState({viewDate:e.state.viewDate.clone()[t](parseInt(n.target.dataset.value)).startOf(t),currentView:s[t]})}},addTime:function(t,e,s){return this.updateTime("add",t,e,s)},subtractTime:function(t,e,s){return this.updateTime("subtract",t,e,s)},updateTime:function(t,e,s,n){var a=this;return function(){var r={},o=n?"selectedDate":"viewDate";r[o]=a.state[o].clone()[t](e,s),a.setState(r)}},allowedSetTime:["hours","minutes","seconds","milliseconds"],setTime:function(t,e){var s,n=this.allowedSetTime.indexOf(t)+1,a=this.state.selectedDate.clone();for(a[t](e);n<this.allowedSetTime.length;n++)s=this.allowedSetTime[n],a[s](a[s]());this.setState({selectedDate:a,inputValue:a.format(this.state.inputFormat)},this.callOnChange)},callOnChange:function(){this.props.onChange(this.state.selectedDate.format(this.state.inputFormat))},updateDate:function(t){var e,s=t.target,n=0,a=this.state.selectedDate;-1!=s.className.indexOf("new")?n=1:-1!=s.className.indexOf("old")&&(n=-1),e=this.state.viewDate.clone().month(this.state.viewDate.month()+n).date(parseInt(s.dataset.value)).hours(a.hours()).minutes(a.minutes()).seconds(a.seconds()).milliseconds(a.milliseconds()),this.setState({selectedDate:e,viewDate:e.clone().startOf("month"),inputValue:e.format(this.state.inputFormat)},this.callOnChange)},openCalendar:function(){this.setState({open:!0})},handleClickOutside:function(){this.props.onBlur(this.state.inputValue),this.props.input&&this.state.open&&this.setState({open:!1})},localMoment:function(t){var e=u(t);return this.props.locale&&e.locale(this.props.locale),e},componentProps:{fromProps:["viewMode","minDate","maxDate","renderDay","renderMonth","renderYear"],fromState:["viewDate","selectedDate"],fromThis:["setDate","setTime","showView","addTime","subtractTime","updateDate","localMoment"]},getComponentProps:function(){var t=this,e=this.getFormats(this.props),s={dateFormat:e.date,timeFormat:e.time};return this.componentProps.fromProps.forEach(function(e){s[e]=t.props[e]}),this.componentProps.fromState.forEach(function(e){s[e]=t.state[e]}),this.componentProps.fromThis.forEach(function(e){s[e]=t[e]}),s},render:function(){var t=this.viewComponents[this.state.currentView],e=a.DOM,s="rdt",r=[];return this.props.input?r=[e.input(n({key:"i",type:"text",className:"form-control",onFocus:this.openCalendar,onChange:this.onChange,value:this.state.inputValue},this.props.inputProps))]:s+=" rdtStatic",this.state.open&&(s+=" rdtOpen"),e.div({className:s},r.concat(e.div({key:"dt",className:"rdtPicker"},a.createElement(t,this.getComponentProps()))))}});t.exports=l},function(t,e,s){"use strict";var n=s(2),a=n.DOM,r=n.createClass({render:function(){var t=10*parseInt(this.props.viewDate.year()/10,10);return a.div({className:"rdtYears"},[a.table({key:"a"},a.thead({},a.tr({},[a.th({key:"prev",className:"prev"},a.button({onClick:this.props.subtractTime(10,"years")},"‹")),a.th({key:"year",className:"switch",onClick:this.props.showView("years"),colSpan:2},t+"-"+(t+9)),a.th({key:"next",className:"next"},a.button({onClick:this.props.addTime(10,"years")},"›"))]))),a.table({key:"years"},a.tbody({},this.renderYears(t)))])},renderYears:function(t){var e,s,n=[],r=-1,o=[],i=this.props.renderYear||this.renderYear;for(t--;11>r;)e="year",-1===r|10===r&&(e+=" old"),this.props.selectedDate.year()===t&&(e+=" active"),s={key:t,"data-value":t,className:e,onClick:this.props.setDate("year")},n.push(i(s,t,this.props.selectedDate.clone())),4==n.length&&(o.push(a.tr({key:r},n)),n=[]),t++,r++;return o},renderYear:function(t,e,s){return a.td(t,e)}});t.exports=r},function(e,s){e.exports=t},function(t,e){"use strict";function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function n(t){var e=Object.getOwnPropertyNames(t);return Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(t))),e.filter(function(e){return a.call(t,e)})}var a=Object.prototype.propertyIsEnumerable;t.exports=Object.assign||function(t,e){for(var a,r,o=s(t),i=1;i<arguments.length;i++){a=arguments[i],r=n(Object(a));for(var c=0;c<r.length;c++)o[r[c]]=a[r[c]]}return o}},function(t,e,s){var n=s(2),a=s(5),r=n.DOM,o=n.createClass({render:function(){var t,e=this.renderFooter(),s=this.props.viewDate,n=s.localeData();return t=[r.thead({key:"th"},[r.tr({key:"h"},[r.th({key:"p",className:"prev"},r.button({onClick:this.props.subtractTime(1,"months")},"‹")),r.th({key:"s",className:"switch",onClick:this.props.showView("months"),colSpan:5},n.months(s)+" "+s.year()),r.th({key:"n",className:"next"},r.button({onClick:this.props.addTime(1,"months")},"›"))]),r.tr({key:"d"},this.getDaysOfWeek(n).map(function(t){return r.th({key:t,className:"dow"},t)}))]),r.tbody({key:"tb"},this.renderDays())],e&&t.push(e),r.div({className:"rdtDays"},r.table({},t))},getDaysOfWeek:function(t){var e=t._weekdaysMin,s=t.firstDayOfWeek(),n=[],a=0;return e.forEach(function(t){n[(7+a++-s)%7]=t}),n},renderDays:function(){var t,e,s,n=this.props.viewDate,o=this.props.selectedDate.clone(),i=n.clone().subtract(1,"months"),c=n.year(),u=n.month(),d={y:o.year(),M:o.month(),d:o.date()},l=this.props.minDate,p=this.props.maxDate,h=[],m=[],f=this.props.renderDay||this.renderDay;i.date(i.daysInMonth()).startOf("week");for(var v=i.clone().add(42,"d");i.isBefore(v);)t="day",i.year()<c||i.month()<u?t+=" old":(i.year()>c||i.month()>u)&&(t+=" new"),i.isSame(d)&&(t+=" active"),i.isSame(a(),"day")&&(t+=" today"),e=l&&i.isBefore(l)||p&&i.isAfter(p),e&&(t+=" disabled"),s={key:i.format("M_D"),"data-value":i.date(),className:t},e||(s.onClick=this.props.updateDate),m.push(f(s,i.clone(),o)),7==m.length&&(h.push(r.tr({key:i.format("M_D")},m)),m=[]),i.add(1,"d");return h},renderDay:function(t,e,s){return r.td(t,e.date())},renderFooter:function(){return this.props.timeFormat?r.tfoot({key:"tf"},r.tr({},r.td({onClick:this.props.showView("time"),colSpan:7,className:"timeToggle"},this.props.selectedDate.format(this.props.timeFormat)))):""}});t.exports=o},function(t,s){t.exports=e},function(t,e,s){"use strict";var n=s(2),a=(s(5),n.DOM),r=n.createClass({render:function(){return a.div({className:"rdtMonths"},[a.table({key:"a"},a.thead({},a.tr({},[a.th({key:"prev",className:"prev"},a.button({onClick:this.props.subtractTime(1,"years")},"‹")),a.th({key:"year",className:"switch",onClick:this.props.showView("years"),colSpan:2},this.props.viewDate.year()),a.th({key:"next",className:"next"},a.button({onClick:this.props.addTime(1,"years")},"›"))]))),a.table({key:"months"},a.tbody({key:"b"},this.renderMonths()))])},renderMonths:function(){for(var t,e,s=this.props.selectedDate,n=s.month(),r=this.props.viewDate.year(),o=[],i=0,c=[],u=this.props.renderMonth||this.renderMonth;12>i;)t="month",i===n&&r===s.year()&&(t+=" active"),e={key:i,"data-value":i,className:t,onClick:this.props.setDate("month")},c.push(u(e,i,r,s.clone())),4==c.length&&(o.push(a.tr({key:n+"_"+o.length},c)),c=[]),i++;return o},renderMonth:function(t,e,s,n){return a.td(t,n.localeData()._monthsShort[e])}});t.exports=r},function(t,e,s){"use strict";var n=s(2),a=n.DOM,r=n.createClass({getInitialState:function(){var t=this.props.selectedDate,e=this.props.timeFormat,s=[];return(-1!=e.indexOf("H")||-1!=e.indexOf("h"))&&(s.push("hours"),-1!=e.indexOf("m")&&(s.push("minutes"),-1!=e.indexOf("s")&&s.push("seconds"))),{hours:t.format("H"),minutes:t.format("mm"),seconds:t.format("ss"),milliseconds:t.format("SSS"),counters:s}},renderCounter:function(t){return a.div({key:t,className:"rdtCounter"},[a.button({key:"up",className:"btn",onMouseDown:this.onStartClicking("increase",t)},"▲"),a.div({key:"c",className:"rdtCount"},this.state[t]),a.button({key:"do",className:"btn",onMouseDown:this.onStartClicking("decrease",t)},"▼")])},render:function(){var t=this,e=[];return this.state.counters.forEach(function(s){e.length&&e.push(a.div({key:"sep"+e.length,className:"rdtCounterSeparator"},":")),e.push(t.renderCounter(s))}),3==this.state.counters.length&&-1!=this.props.timeFormat.indexOf("S")&&(e.push(a.div({className:"rdtCounterSeparator",key:"sep5"},":")),e.push(a.div({className:"rdtCounter rdtMilli",key:"m"},a.input({value:this.state.milliseconds,type:"text",onChange:this.updateMilli})))),a.div({className:"rdtTime"},a.table({},[this.renderHeader(),a.tbody({key:"b"},a.tr({},a.td({},a.div({className:"rdtCounters"},e))))]))},updateMilli:function(t){var e=parseInt(t.target.value);e==t.target.value&&e>=0&&1e3>e&&(this.props.setTime("milliseconds",e),this.setState({milliseconds:e}))},renderHeader:function(){return this.props.dateFormat?a.thead({key:"h"},a.tr({},a.th({colSpan:4,onClick:this.props.showView("days")},this.props.selectedDate.format(this.props.dateFormat)))):""},onStartClicking:function(t,e){var s=this;return function(){var n={};n[e]=s[t](e),s.setState(n),s.timer=setTimeout(function(){s.increaseTimer=setInterval(function(){n[e]=s[t](e),s.setState(n)},80)},500),document.body.addEventListener("mouseup",function(){clearTimeout(s.timer),clearInterval(s.increaseTimer),s.props.setTime(e,s.state[e])})}},maxValues:{hours:23,minutes:59,seconds:59,milliseconds:999},padValues:{hours:1,minutes:2,seconds:2,milliseconds:3},increase:function(t){var e=parseInt(this.state[t])+1;return e>this.maxValues[t]&&(e=0),this.pad(t,e)},decrease:function(t){var e=parseInt(this.state[t])-1;return 0>e&&(e=this.maxValues[t]),this.pad(t,e)},pad:function(t,e){for(var s=e+"";s.length<this.padValues[t];)s="0"+s;return s}});t.exports=r},function(t,e,s){var n,a,r;!function(s,o){a=[],n=o,r="function"==typeof n?n.apply(e,a):n,!(void 0!==r&&(t.exports=r))}(this,function(){"use strict";var t=[],e=[],s="ignore-react-onclickoutside";return{componentDidMount:function(){if(!this.handleClickOutside)throw new Error("Component lacks a handleClickOutside(event) function for processing outside click events.");var n=this.__outsideClickHandler=function(t,e){return function(n){for(var a=n.target,r=!1;a.parentNode;){if(r=a===t||a.classList.contains(s))return;a=a.parentNode}e(n)}}(this.getDOMNode(),this.handleClickOutside),a=t.length;t.push(this),e[a]=n,this.props.disableOnClickOutside||this.enableOnClickOutside()},componentWillUnmount:function(){this.disableOnClickOutside(),this.__outsideClickHandler=!1;var s=t.indexOf(this);s>-1&&e[s]&&(e.splice(s,1),t.splice(s,1))},enableOnClickOutside:function(){var t=this.__outsideClickHandler;document.addEventListener("mousedown",t),document.addEventListener("touchstart",t)},disableOnClickOutside:function(t){var t=this.__outsideClickHandler;document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}})}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require(void 0),require(void 0)):"function"==typeof define&&define.amd?define([,],e):"object"==typeof exports?exports.Datetime=e(require(void 0),require(void 0)):t.Datetime=e(t.React,t.moment)}(this,function(t,e){return function(t){function e(n){if(s[n])return s[n].exports;var r=s[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var s={};return e.m=t,e.c=s,e.p="",e(0)}([function(t,e,s){"use strict";var n=s(3),r=s(2),a=s(4),o=s(6),i=s(1),c=s(7),u=s(5),d=r.PropTypes,p=r.createClass({mixins:[s(8)],viewComponents:{days:a,months:o,years:i,time:c},propTypes:{date:d.object,onBlur:d.func,onChange:d.func,locale:d.string,input:d.bool,dateFormat:d.string,timeFormat:d.string,inputProps:d.object,viewMode:d.oneOf(["years","months","days","time"]),minDate:d.object,maxDate:d.object},getDefaultProps:function(){var t=function(){};return{date:new Date,viewMode:"days",inputProps:{},input:!0,onBlur:t,onChange:t}},getInitialState:function(){var t=this.getFormats(this.props),e=this.props.date;return{currentView:this.props.viewMode,open:!this.props.input,inputFormat:t.datetime,viewDate:this.localMoment(e).startOf("month"),selectedDate:this.localMoment(e),inputValue:this.localMoment(e).format(t.datetime)}},getFormats:function(t){var e={date:"",time:"",datetime:""},s=this.localMoment(t.date).localeData();return t.dateFormat&&(e.date=t.dateFormat),t.timeFormat&&(e.time=t.timeFormat),e.date||e.time?(t.dateFormat&&(e.date=t.dateFormat,e.datetime=e.date),t.timeFormat&&(e.date&&(e.datetime+=" "),e.time=t.timeFormat,e.datetime+=e.time)):(e.date=s.longDateFormat("L"),e.time=s.longDateFormat("LT"),e.datetime=e.date+" "+e.time),e},componentWillReceiveProps:function(t){var e=this.getFormats(t);return e.datetime!==this.getFormats(this.props).datetime?this.setState({inputFormat:t.inputFormat}):void 0},onChange:function(t){var e=null==t.target?t:t.target.value,s=this.localMoment(date);return s.isValid()&&this.setState({selectedDate:s,viewDate:s.clone().startOf("month")}),this.setState({inputValue:e},function(){return this.props.onChange(s.toDate())})},showView:function(t){var e=this;return function(s){e.setState({currentView:t})}},setDate:function(t){var e=this,s={month:"days",year:"months"};return function(n){e.setState({viewDate:e.state.viewDate.clone()[t](parseInt(n.target.dataset.value)).startOf(t),currentView:s[t]})}},addTime:function(t,e,s){return this.updateTime("add",t,e,s)},subtractTime:function(t,e,s){return this.updateTime("subtract",t,e,s)},updateTime:function(t,e,s,n){var r=this;return function(){var a={},o=n?"selectedDate":"viewDate";a[o]=r.state[o].clone()[t](e,s),r.setState(a)}},allowedSetTime:["hours","minutes","seconds","milliseconds"],setTime:function(t,e){var s,n=this.allowedSetTime.indexOf(t)+1,r=this.state.selectedDate.clone();for(r[t](e);n<this.allowedSetTime.length;n++)s=this.allowedSetTime[n],r[s](r[s]());this.setState({selectedDate:r,inputValue:r.format(this.state.inputFormat)}),this.props.onChange(r)},updateDate:function(t){var e,s=t.target,n=0,r=this.state.selectedDate;-1!=s.className.indexOf("new")?n=1:-1!=s.className.indexOf("old")&&(n=-1),e=this.state.viewDate.clone().month(this.state.viewDate.month()+n).date(parseInt(s.dataset.value)).hours(r.hours()).minutes(r.minutes()).seconds(r.seconds()).milliseconds(r.milliseconds()),this.setState({selectedDate:e,viewDate:e.clone().startOf("month"),inputValue:e.format(this.state.inputFormat)}),this.props.onChange(e)},openCalendar:function(){this.setState({open:!0})},handleClickOutside:function(){this.props.onBlur(this.state.selectedDate),this.props.input&&this.state.open&&this.setState({open:!1})},localMoment:function(t){var e=u(t);return this.props.locale&&e.locale(this.props.locale),e},componentProps:{fromProps:["viewMode","minDate","maxDate","renderDay","renderMonth","renderYear"],fromState:["viewDate","selectedDate"],fromThis:["setDate","setTime","showView","addTime","subtractTime","updateDate","localMoment"]},getComponentProps:function(){var t=this,e=this.getFormats(this.props),s={dateFormat:e.date,timeFormat:e.time};return this.componentProps.fromProps.forEach(function(e){s[e]=t.props[e]}),this.componentProps.fromState.forEach(function(e){s[e]=t.state[e]}),this.componentProps.fromThis.forEach(function(e){s[e]=t[e]}),s},render:function(){var t=this.viewComponents[this.state.currentView],e=r.DOM,s="rdt",a=[];return this.props.input?a=[e.input(n({key:"i",type:"text",className:"form-control",onFocus:this.openCalendar,onChange:this.onChange,value:this.state.inputValue},this.props.inputProps))]:s+=" rdtStatic",this.state.open&&(s+=" rdtOpen"),e.div({className:s},a.concat(e.div({key:"dt",className:"rdtPicker"},r.createElement(t,this.getComponentProps()))))}});t.exports=p},function(t,e,s){"use strict";var n=s(2),r=n.DOM,a=n.createClass({render:function(){var t=10*parseInt(this.props.viewDate.year()/10,10);return r.div({className:"rdtYears"},[r.table({key:"a"},r.thead({},r.tr({},[r.th({key:"prev",className:"prev"},r.button({onClick:this.props.subtractTime(10,"years")},"‹")),r.th({key:"year",className:"switch",onClick:this.props.showView("years"),colSpan:2},t+"-"+(t+9)),r.th({key:"next",className:"next"},r.button({onClick:this.props.addTime(10,"years")},"›"))]))),r.table({key:"years"},r.tbody({},this.renderYears(t)))])},renderYears:function(t){var e,s,n=[],a=-1,o=[],i=this.props.renderYear||this.renderYear;for(t--;11>a;)e="year",-1===a|10===a&&(e+=" old"),this.props.selectedDate.year()===t&&(e+=" active"),s={key:t,"data-value":t,className:e,onClick:this.props.setDate("year")},n.push(i(s,t,this.props.selectedDate.clone())),4==n.length&&(o.push(r.tr({key:a},n)),n=[]),t++,a++;return o},renderYear:function(t,e,s){return r.td(t,e)}});t.exports=a},function(e,s){e.exports=t},function(t,e){"use strict";function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function n(t){var e=Object.getOwnPropertyNames(t);return Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(t))),e.filter(function(e){return r.call(t,e)})}var r=Object.prototype.propertyIsEnumerable;t.exports=Object.assign||function(t,e){for(var r,a,o=s(t),i=1;i<arguments.length;i++){r=arguments[i],a=n(Object(r));for(var c=0;c<a.length;c++)o[a[c]]=r[a[c]]}return o}},function(t,e,s){var n=s(2),r=s(5),a=n.DOM,o=n.createClass({render:function(){var t,e=this.renderFooter(),s=this.props.viewDate,n=s.localeData();return t=[a.thead({key:"th"},[a.tr({key:"h"},[a.th({key:"p",className:"prev"},a.button({onClick:this.props.subtractTime(1,"months")},"‹")),a.th({key:"s",className:"switch",onClick:this.props.showView("months"),colSpan:5},n.months(s)+" "+s.year()),a.th({key:"n",className:"next"},a.button({onClick:this.props.addTime(1,"months")},"›"))]),a.tr({key:"d"},this.getDaysOfWeek(n).map(function(t){return a.th({key:t,className:"dow"},t)}))]),a.tbody({key:"tb"},this.renderDays())],e&&t.push(e),a.div({className:"rdtDays"},a.table({},t))},getDaysOfWeek:function(t){var e=t._weekdaysMin,s=t.firstDayOfWeek(),n=[],r=0;return e.forEach(function(t){n[(7+r++-s)%7]=t}),n},renderDays:function(){var t,e,s,n=this.props.viewDate,o=this.props.selectedDate.clone(),i=n.clone().subtract(1,"months"),c=n.year(),u=n.month(),d={y:o.year(),M:o.month(),d:o.date()},p=this.props.minDate,l=this.props.maxDate,h=[],m=[],f=this.props.renderDay||this.renderDay;i.date(i.daysInMonth()).startOf("week");for(var v=i.clone().add(42,"d");i.isBefore(v);)t="day",i.year()<c||i.month()<u?t+=" old":(i.year()>c||i.month()>u)&&(t+=" new"),i.isSame(d)&&(t+=" active"),i.isSame(r(),"day")&&(t+=" today"),e=p&&i.isBefore(p)||l&&i.isAfter(l),e&&(t+=" disabled"),s={key:i.format("M_D"),"data-value":i.date(),className:t},e||(s.onClick=this.props.updateDate),m.push(f(s,i.clone(),o)),7==m.length&&(h.push(a.tr({key:i.format("M_D")},m)),m=[]),i.add(1,"d");return h},renderDay:function(t,e,s){return a.td(t,e.date())},renderFooter:function(){return this.props.timeFormat?a.tfoot({key:"tf"},a.tr({},a.td({onClick:this.props.showView("time"),colSpan:7,className:"timeToggle"},this.props.selectedDate.format(this.props.timeFormat)))):""}});t.exports=o},function(t,s){t.exports=e},function(t,e,s){"use strict";var n=s(2),r=(s(5),n.DOM),a=n.createClass({render:function(){return r.div({className:"rdtMonths"},[r.table({key:"a"},r.thead({},r.tr({},[r.th({key:"prev",className:"prev"},r.button({onClick:this.props.subtractTime(1,"years")},"‹")),r.th({key:"year",className:"switch",onClick:this.props.showView("years"),colSpan:2},this.props.viewDate.year()),r.th({key:"next",className:"next"},r.button({onClick:this.props.addTime(1,"years")},"›"))]))),r.table({key:"months"},r.tbody({key:"b"},this.renderMonths()))])},renderMonths:function(){for(var t,e,s=this.props.selectedDate,n=s.month(),a=this.props.viewDate.year(),o=[],i=0,c=[],u=this.props.renderMonth||this.renderMonth;12>i;)t="month",i===n&&a===s.year()&&(t+=" active"),e={key:i,"data-value":i,className:t,onClick:this.props.setDate("month")},c.push(u(e,i,a,s.clone())),4==c.length&&(o.push(r.tr({key:n+"_"+o.length},c)),c=[]),i++;return o},renderMonth:function(t,e,s,n){return r.td(t,n.localeData()._monthsShort[e])}});t.exports=a},function(t,e,s){"use strict";var n=s(2),r=n.DOM,a=n.createClass({getInitialState:function(){var t=this.props.selectedDate,e=this.props.timeFormat,s=[];return(-1!=e.indexOf("H")||-1!=e.indexOf("h"))&&(s.push("hours"),-1!=e.indexOf("m")&&(s.push("minutes"),-1!=e.indexOf("s")&&s.push("seconds"))),{hours:t.format("H"),minutes:t.format("mm"),seconds:t.format("ss"),milliseconds:t.format("SSS"),counters:s}},renderCounter:function(t){return r.div({key:t,className:"rdtCounter"},[r.button({key:"up",className:"btn",onMouseDown:this.onStartClicking("increase",t)},"▲"),r.div({key:"c",className:"rdtCount"},this.state[t]),r.button({key:"do",className:"btn",onMouseDown:this.onStartClicking("decrease",t)},"▼")])},render:function(){var t=this,e=[];return this.state.counters.forEach(function(s){e.length&&e.push(r.div({key:"sep"+e.length,className:"rdtCounterSeparator"},":")),e.push(t.renderCounter(s))}),3==this.state.counters.length&&-1!=this.props.timeFormat.indexOf("S")&&(e.push(r.div({className:"rdtCounterSeparator",key:"sep5"},":")),e.push(r.div({className:"rdtCounter rdtMilli",key:"m"},r.input({value:this.state.milliseconds,type:"text",onChange:this.updateMilli})))),r.div({className:"rdtTime"},r.table({},[this.renderHeader(),r.tbody({key:"b"},r.tr({},r.td({},r.div({className:"rdtCounters"},e))))]))},updateMilli:function(t){var e=parseInt(t.target.value);e==t.target.value&&e>=0&&1e3>e&&(this.props.setTime("milliseconds",e),this.setState({milliseconds:e}))},renderHeader:function(){return this.props.dateFormat?r.thead({key:"h"},r.tr({},r.th({colSpan:4,onClick:this.props.showView("days")},this.props.selectedDate.format(this.props.dateFormat)))):""},onStartClicking:function(t,e){var s=this;return function(){var n={};n[e]=s[t](e),s.setState(n),s.timer=setTimeout(function(){s.increaseTimer=setInterval(function(){n[e]=s[t](e),s.setState(n)},80)},500),s.mouseUpListener=function(){clearTimeout(s.timer),clearInterval(s.increaseTimer),s.props.setTime(e,s.state[e]),document.body.removeEventListener("mouseup",s.mouseUpListener)},document.body.addEventListener("mouseup",s.mouseUpListener)}},maxValues:{hours:23,minutes:59,seconds:59,milliseconds:999},padValues:{hours:1,minutes:2,seconds:2,milliseconds:3},increase:function(t){var e=parseInt(this.state[t])+1;return e>this.maxValues[t]&&(e=0),this.pad(t,e)},decrease:function(t){var e=parseInt(this.state[t])-1;return 0>e&&(e=this.maxValues[t]),this.pad(t,e)},pad:function(t,e){for(var s=e+"";s.length<this.padValues[t];)s="0"+s;return s}});t.exports=a},function(t,e,s){var n,r,a;!function(s,o){r=[],n=o,a="function"==typeof n?n.apply(e,r):n,!(void 0!==a&&(t.exports=a))}(this,function(){"use strict";var t=[],e=[],s="ignore-react-onclickoutside";return{componentDidMount:function(){if(!this.handleClickOutside)throw new Error("Component lacks a handleClickOutside(event) function for processing outside click events.");var n=this.__outsideClickHandler=function(t,e){return function(n){for(var r=n.target,a=!1;r.parentNode;){if(a=r===t||r.classList.contains(s))return;r=r.parentNode}e(n)}}(this.getDOMNode(),this.handleClickOutside),r=t.length;t.push(this),e[r]=n,this.props.disableOnClickOutside||this.enableOnClickOutside()},componentWillUnmount:function(){this.disableOnClickOutside(),this.__outsideClickHandler=!1;var s=t.indexOf(this);s>-1&&e[s]&&(e.splice(s,1),t.splice(s,1))},enableOnClickOutside:function(){var t=this.__outsideClickHandler;document.addEventListener("mousedown",t),document.addEventListener("touchstart",t)},disableOnClickOutside:function(t){var t=this.__outsideClickHandler;document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}})}])});
karma.dev.js
File was deleted
package.json
@@ -1,6 +1,6 @@
{
  "name": "react-datetime",
  "version": "0.4.3",
  "version": "0.5.0",
  "description": "A lightweight but complete datetime picker React.js component.",
  "homepage": "https://github.com/arqex/react-datetime",
  "repository": {
@@ -9,12 +9,7 @@
  },
  "main": "./DateTime.js",
  "scripts": {
    "build-npm": "jsx -x jsx ./src/ ./lib/",
    "build": "./node_modules/.bin/gulp.cmd",
    "build-min": "$COMPRESS=1 webpack --output-file react-bootstrap-datetimepicker.min.js",
    "examples": "webpack-dev-server --config ./examples/webpack.config.js",
    "test-watch": "./node_modules/.bin/grunt watch 2>&1 >/dev/null & karma start karma.dev.js",
    "test": "./node_modules/.bin/grunt build && karma start karma.ci.js"
    "build": "./node_modules/.bin/gulp.cmd"
  },
  "keywords": [
    "react",