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

react-datetime

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-datetime - npm Package Compare versions

Comparing version 2.3.2 to 2.3.3

5

CHANGELOG.md
Changelog
=========
## 2.3.3
* Updated readme.
* Fixed short months for not English locales.
* Fixed mixed 12 AM/PM.
## 2.3.2

@@ -4,0 +9,0 @@ * Time editor now handles the A format to display 12h times.

6

dist/react-datetime.js
/*
react-datetime v2.3.2
react-datetime v2.3.3
https://github.com/arqex/react-datetime

@@ -92,3 +92,3 @@ MIT: https://github.com/arqex/react-datetime/raw/master/LICENSE

eval("'use strict';\n\nvar React = __webpack_require__(2),\nmoment = __webpack_require__(4)\n;\n\nvar DOM = React.DOM;\nvar DateTimePickerMonths = React.createClass({\n\trender: function() {\n\t\treturn DOM.div({ className: 'rdtMonths' },[\n\t\t\tDOM.table({ key: 'a'}, DOM.thead({}, DOM.tr({},[\n\t\t\t\tDOM.th({ key: 'prev', className: 'rdtPrev' }, DOM.span({onClick: this.props.subtractTime(1, 'years')}, '‹')),\n\t\t\t\tDOM.th({ key: 'year', className: 'rdtSwitch', onClick: this.props.showView('years'), colSpan: 2, 'data-value': this.props.viewDate.year()}, this.props.viewDate.year() ),\n\t\t\t\tDOM.th({ key: 'next', className: 'rdtNext' }, DOM.span({onClick: this.props.addTime(1, 'years')}, '›'))\n\t\t\t]))),\n\t\t\tDOM.table({ key: 'months'}, DOM.tbody({ key: 'b'}, this.renderMonths()))\n\t\t]);\n\t},\n\n\trenderMonths: function() {\n\t\tvar date = this.props.selectedDate,\n\t\t\tmonth = this.props.viewDate.month(),\n\t\t\tyear = this.props.viewDate.year(),\n\t\t\trows = [],\n\t\t\ti = 0,\n\t\t\tmonths = [],\n\t\t\trenderer = this.props.renderMonth || this.renderMonth,\n\t\t\tclasses, props\n\t\t;\n\n\t\twhile (i < 12) {\n\t\t\tclasses = \"rdtMonth\";\n\t\t\tif( date && i === month && year === date.year() )\n\t\t\t\tclasses += \" rdtActive\";\n\n\t\t\tprops = {\n\t\t\t\tkey: i,\n\t\t\t\t'data-value': i,\n\t\t\t\tclassName: classes,\n\t\t\t\tonClick: this.props.updateOn==\"months\"? this.updateSelectedMonth : this.props.setDate('month')\n\t\t\t};\n\n\t\t\tmonths.push( renderer( props, i, year, date && date.clone() ));\n\n\t\t\tif( months.length == 4 ){\n\t\t\t\trows.push( DOM.tr({ key: month + '_' + rows.length }, months) );\n\t\t\t\tmonths = [];\n\t\t\t}\n\n\t\t\ti++;\n\t\t}\n\n\t\treturn rows;\n\t},\n\n\tupdateSelectedMonth: function( event ) {\n\t\tthis.props.updateSelectedDate(event, true);\n\t},\n\n\trenderMonth: function( props, month, year, selectedDate ) {\n\t\treturn DOM.td( props, this.props.viewDate.localeData()._monthsShort[ month ] );\n\t}\n});\n\nmodule.exports = DateTimePickerMonths;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/MonthsView.js\n ** module id = 5\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/MonthsView.js?");
eval("'use strict';\n\nvar React = __webpack_require__(2),\nmoment = __webpack_require__(4)\n;\n\nvar DOM = React.DOM;\nvar DateTimePickerMonths = React.createClass({\n\trender: function() {\n\t\treturn DOM.div({ className: 'rdtMonths' },[\n\t\t\tDOM.table({ key: 'a'}, DOM.thead({}, DOM.tr({},[\n\t\t\t\tDOM.th({ key: 'prev', className: 'rdtPrev' }, DOM.span({onClick: this.props.subtractTime(1, 'years')}, '‹')),\n\t\t\t\tDOM.th({ key: 'year', className: 'rdtSwitch', onClick: this.props.showView('years'), colSpan: 2, 'data-value': this.props.viewDate.year()}, this.props.viewDate.year() ),\n\t\t\t\tDOM.th({ key: 'next', className: 'rdtNext' }, DOM.span({onClick: this.props.addTime(1, 'years')}, '›'))\n\t\t\t]))),\n\t\t\tDOM.table({ key: 'months'}, DOM.tbody({ key: 'b'}, this.renderMonths()))\n\t\t]);\n\t},\n\n\trenderMonths: function() {\n\t\tvar date = this.props.selectedDate,\n\t\t\tmonth = this.props.viewDate.month(),\n\t\t\tyear = this.props.viewDate.year(),\n\t\t\trows = [],\n\t\t\ti = 0,\n\t\t\tmonths = [],\n\t\t\trenderer = this.props.renderMonth || this.renderMonth,\n\t\t\tclasses, props\n\t\t;\n\n\t\twhile (i < 12) {\n\t\t\tclasses = \"rdtMonth\";\n\t\t\tif( date && i === month && year === date.year() )\n\t\t\t\tclasses += \" rdtActive\";\n\n\t\t\tprops = {\n\t\t\t\tkey: i,\n\t\t\t\t'data-value': i,\n\t\t\t\tclassName: classes,\n\t\t\t\tonClick: this.props.updateOn==\"months\"? this.updateSelectedMonth : this.props.setDate('month')\n\t\t\t};\n\n\t\t\tmonths.push( renderer( props, i, year, date && date.clone() ));\n\n\t\t\tif( months.length == 4 ){\n\t\t\t\trows.push( DOM.tr({ key: month + '_' + rows.length }, months) );\n\t\t\t\tmonths = [];\n\t\t\t}\n\n\t\t\ti++;\n\t\t}\n\n\t\treturn rows;\n\t},\n\n\tupdateSelectedMonth: function( event ) {\n\t\tthis.props.updateSelectedDate(event, true);\n\t},\n\n\trenderMonth: function( props, month, year, selectedDate ) {\n\t\tvar monthsShort = this.props.viewDate.localeData()._monthsShort\n\t\treturn DOM.td( props, monthsShort.standalone\n\t\t\t? capitalize( monthsShort.standalone[ month ] )\n\t\t\t: monthsShort[ month ]\n\t\t)\n\t}\n});\n\nfunction capitalize(str) {\n\treturn str.charAt(0).toUpperCase() + str.slice(1)\n}\n\nmodule.exports = DateTimePickerMonths;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/MonthsView.js\n ** module id = 5\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/MonthsView.js?");

@@ -105,3 +105,3 @@ /***/ },

eval("'use strict';\n\nvar React = __webpack_require__(2);\n\nvar DOM = React.DOM;\nvar DateTimePickerTime = React.createClass({\n\tgetInitialState: function(){\n\t\treturn this.calculateState( this.props );\n\t},\n\tcalculateState: function( props ){\n\t\tvar date = props.selectedDate || props.viewDate,\n\t\t\tformat = props.timeFormat,\n\t\t\tcounters = []\n\t\t;\n\n\t\tif( format.indexOf('H') != -1 || format.indexOf('h') != -1 ){\n\t\t\tcounters.push('hours');\n\t\t\tif( format.indexOf('m') != -1 ){\n\t\t\t\tcounters.push('minutes');\n\t\t\t\tif( format.indexOf('s') != -1 ){\n\t\t\t\t\tcounters.push('seconds');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar daypart = false;\n\t\tif( this.props.timeFormat.indexOf(' A') != -1 && this.state != null ){\n\t\t\tdaypart = ( this.state.hours > 12 ) ? 'PM' : 'AM';\n\t\t}\n\n\t\treturn {\n\t\t\thours: date.format('H'),\n\t\t\tminutes: date.format('mm'),\n\t\t\tseconds: date.format('ss'),\n\t\t\tmilliseconds: date.format('SSS'),\n\t\t\tdaypart: daypart,\n\t\t\tcounters: counters\n\t\t};\n\t},\n\trenderCounter: function( type ){\n\t\tif (type !== 'daypart') {\n\t\t\tvar value = this.state[ type ];\n\t\t\tif (type === 'hours' && this.props.timeFormat.indexOf(' A') != -1 && value > 12) {\n\t\t\t\tvalue = value - 12;\n\t\t\t}\n\t\t\treturn DOM.div({ key: type, className: 'rdtCounter'}, [\n\t\t\t\tDOM.span({ key:'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'increase', type ) }, '▲' ),\n\t\t\t\tDOM.div({ key:'c', className: 'rdtCount' }, value ),\n\t\t\t\tDOM.span({ key:'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'decrease', type ) }, '▼' )\n\t\t\t]);\n\t\t}\n\t\treturn '';\n\t},\n\trender: function() {\n\t\tvar me = this,\n\t\t\tcounters = []\n\t\t;\n\n\t\tthis.state.counters.forEach( function(c){\n\t\t\tif( counters.length )\n\t\t\t\tcounters.push( DOM.div( {key: 'sep' + counters.length, className: 'rdtCounterSeparator' }, ':' ));\n\t\t\tcounters.push( me.renderCounter( c ) );\n\t\t});\n\n\n\t\tif (this.state.daypart !== false) {\n\t\t\tcounters.push(DOM.div({ key: this.state.daypart, className: 'rdtDayPart'}, this.state.daypart ));\n\t\t}\n\n\t\tif( this.state.counters.length == 3 && this.props.timeFormat.indexOf('S') != -1 ){\n\t\t\tcounters.push( DOM.div( {className: 'rdtCounterSeparator', key: 'sep5' }, ':' ));\n\t\t\tcounters.push(\n\t\t\t\tDOM.div( {className: 'rdtCounter rdtMilli', key:'m'},\n\t\t\t\t\tDOM.input({ value: this.state.milliseconds, type: 'text', onChange: this.updateMilli })\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t}\n\n\t\treturn DOM.div( {className: 'rdtTime'},\n\t\t\tDOM.table( {}, [\n\t\t\t\tthis.renderHeader(),\n\t\t\t\tDOM.tbody({key: 'b'}, DOM.tr({}, DOM.td({},\n\t\t\t\t\tDOM.div({ className: 'rdtCounters' }, counters )\n\t\t\t\t)))\n\t\t\t])\n\t\t);\n\t},\n\tcomponentWillReceiveProps: function( nextProps, nextState ){\n\t\tthis.setState( this.calculateState( nextProps ) );\n\t},\n\tupdateMilli: function( e ){\n\t\tvar milli = parseInt( e.target.value );\n\t\tif( milli == e.target.value && milli >= 0 && milli < 1000 ){\n\t\t\tthis.props.setTime( 'milliseconds', milli );\n\t\t\tthis.setState({ milliseconds: milli });\n\t\t}\n\t},\n\trenderHeader: function(){\n\t\tif( !this.props.dateFormat )\n\t\t\treturn null;\n\n\t\tvar date = this.props.selectedDate || this.props.viewDate;\n\t\treturn DOM.thead({ key: 'h'}, DOM.tr({},\n\t\t\tDOM.th( {className: 'rdtSwitch', colSpan: 4, onClick: this.props.showView('days')}, date.format( this.props.dateFormat ) )\n\t\t));\n\t},\n\tonStartClicking: function( action, type ){\n\t\tvar me = this,\n\t\t\tupdate = {},\n\t\t\tvalue = this.state[ type ]\n\t\t;\n\n\n\t\treturn function(){\n\t\t\tvar update = {};\n\t\t\tupdate[ type ] = me[ action ]( type );\n\t\t\tme.setState( update );\n\n\t\t\tme.timer = setTimeout( function(){\n\t\t\t\tme.increaseTimer = setInterval( function(){\n\t\t\t\t\tupdate[ type ] = me[ action ]( type );\n\t\t\t\t\tme.setState( update );\n\t\t\t\t},70);\n\t\t\t}, 500);\n\n\t\t\tme.mouseUpListener = function(){\n\t\t\t\tclearTimeout( me.timer );\n\t\t\t\tclearInterval( me.increaseTimer );\n\t\t\t\tme.props.setTime( type, me.state[ type ] );\n\t\t\t\tdocument.body.removeEventListener('mouseup', me.mouseUpListener);\n\t\t\t};\n\n\t\t\tdocument.body.addEventListener('mouseup', me.mouseUpListener);\n\t\t};\n\t},\n\n\tmaxValues: {\n\t\thours: 23,\n\t\tminutes: 59,\n\t\tseconds: 59,\n\t\tmilliseconds: 999\n\t},\n\tpadValues: {\n\t\thours: 1,\n\t\tminutes: 2,\n\t\tseconds: 2,\n\t\tmilliseconds: 3\n\t},\n\tincrease: function( type ){\n\t\tvar value = parseInt(this.state[ type ]) + 1;\n\t\tif( value > this.maxValues[ type ] )\n\t\t\tvalue = 0;\n\t\treturn this.pad( type, value );\n\t},\n\tdecrease: function( type ){\n\t\tvar value = parseInt(this.state[ type ]) - 1;\n\t\tif( value < 0 )\n\t\t\tvalue = this.maxValues[ type ];\n\t\treturn this.pad( type, value );\n\t},\n\tpad: function( type, value ){\n\t\tvar str = value + '';\n\t\twhile( str.length < this.padValues[ type ] )\n\t\t\tstr = '0' + str;\n\t\treturn str;\n\t}\n});\n\nmodule.exports = DateTimePickerTime;\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';\n\nvar React = __webpack_require__(2);\n\nvar DOM = React.DOM;\nvar DateTimePickerTime = React.createClass({\n\tgetInitialState: function(){\n\t\treturn this.calculateState( this.props );\n\t},\n\tcalculateState: function( props ){\n\t\tvar date = props.selectedDate || props.viewDate,\n\t\t\tformat = props.timeFormat,\n\t\t\tcounters = []\n\t\t;\n\n\t\tif( format.indexOf('H') != -1 || format.indexOf('h') != -1 ){\n\t\t\tcounters.push('hours');\n\t\t\tif( format.indexOf('m') != -1 ){\n\t\t\t\tcounters.push('minutes');\n\t\t\t\tif( format.indexOf('s') != -1 ){\n\t\t\t\t\tcounters.push('seconds');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvar daypart = false;\n\t\tif( this.props.timeFormat.indexOf(' A') != -1 && this.state != null ){\n\t\t\tdaypart = ( this.state.hours >= 12 ) ? 'PM' : 'AM';\n\t\t}\n\n\t\treturn {\n\t\t\thours: date.format('H'),\n\t\t\tminutes: date.format('mm'),\n\t\t\tseconds: date.format('ss'),\n\t\t\tmilliseconds: date.format('SSS'),\n\t\t\tdaypart: daypart,\n\t\t\tcounters: counters\n\t\t};\n\t},\n\trenderCounter: function( type ){\n\t\tif (type !== 'daypart') {\n\t\t\tvar value = this.state[ type ];\n\t\t\tif (type === 'hours' && this.props.timeFormat.indexOf(' A') != -1 && value > 12) {\n\t\t\t\tif(value > 12){\n\t\t\t\t\tvalue = value - 12;\n\t\t\t\t}\n\t\t\t\tif(value == 0) {\n\t\t\t\t\tvalue = 12;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn DOM.div({ key: type, className: 'rdtCounter'}, [\n\t\t\t\tDOM.span({ key:'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'increase', type ) }, '▲' ),\n\t\t\t\tDOM.div({ key:'c', className: 'rdtCount' }, value ),\n\t\t\t\tDOM.span({ key:'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'decrease', type ) }, '▼' )\n\t\t\t]);\n\t\t}\n\t\treturn '';\n\t},\n\trender: function() {\n\t\tvar me = this,\n\t\t\tcounters = []\n\t\t;\n\n\t\tthis.state.counters.forEach( function(c){\n\t\t\tif( counters.length )\n\t\t\t\tcounters.push( DOM.div( {key: 'sep' + counters.length, className: 'rdtCounterSeparator' }, ':' ));\n\t\t\tcounters.push( me.renderCounter( c ) );\n\t\t});\n\n\n\t\tif (this.state.daypart !== false) {\n\t\t\tcounters.push(DOM.div({ key: this.state.daypart, className: 'rdtDayPart'}, this.state.daypart ));\n\t\t}\n\n\t\tif( this.state.counters.length == 3 && this.props.timeFormat.indexOf('S') != -1 ){\n\t\t\tcounters.push( DOM.div( {className: 'rdtCounterSeparator', key: 'sep5' }, ':' ));\n\t\t\tcounters.push(\n\t\t\t\tDOM.div( {className: 'rdtCounter rdtMilli', key:'m'},\n\t\t\t\t\tDOM.input({ value: this.state.milliseconds, type: 'text', onChange: this.updateMilli })\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t}\n\n\t\treturn DOM.div( {className: 'rdtTime'},\n\t\t\tDOM.table( {}, [\n\t\t\t\tthis.renderHeader(),\n\t\t\t\tDOM.tbody({key: 'b'}, DOM.tr({}, DOM.td({},\n\t\t\t\t\tDOM.div({ className: 'rdtCounters' }, counters )\n\t\t\t\t)))\n\t\t\t])\n\t\t);\n\t},\n\tcomponentWillReceiveProps: function( nextProps, nextState ){\n\t\tthis.setState( this.calculateState( nextProps ) );\n\t},\n\tupdateMilli: function( e ){\n\t\tvar milli = parseInt( e.target.value );\n\t\tif( milli == e.target.value && milli >= 0 && milli < 1000 ){\n\t\t\tthis.props.setTime( 'milliseconds', milli );\n\t\t\tthis.setState({ milliseconds: milli });\n\t\t}\n\t},\n\trenderHeader: function(){\n\t\tif( !this.props.dateFormat )\n\t\t\treturn null;\n\n\t\tvar date = this.props.selectedDate || this.props.viewDate;\n\t\treturn DOM.thead({ key: 'h'}, DOM.tr({},\n\t\t\tDOM.th( {className: 'rdtSwitch', colSpan: 4, onClick: this.props.showView('days')}, date.format( this.props.dateFormat ) )\n\t\t));\n\t},\n\tonStartClicking: function( action, type ){\n\t\tvar me = this,\n\t\t\tupdate = {},\n\t\t\tvalue = this.state[ type ]\n\t\t;\n\n\n\t\treturn function(){\n\t\t\tvar update = {};\n\t\t\tupdate[ type ] = me[ action ]( type );\n\t\t\tme.setState( update );\n\n\t\t\tme.timer = setTimeout( function(){\n\t\t\t\tme.increaseTimer = setInterval( function(){\n\t\t\t\t\tupdate[ type ] = me[ action ]( type );\n\t\t\t\t\tme.setState( update );\n\t\t\t\t},70);\n\t\t\t}, 500);\n\n\t\t\tme.mouseUpListener = function(){\n\t\t\t\tclearTimeout( me.timer );\n\t\t\t\tclearInterval( me.increaseTimer );\n\t\t\t\tme.props.setTime( type, me.state[ type ] );\n\t\t\t\tdocument.body.removeEventListener('mouseup', me.mouseUpListener);\n\t\t\t};\n\n\t\t\tdocument.body.addEventListener('mouseup', me.mouseUpListener);\n\t\t};\n\t},\n\n\tmaxValues: {\n\t\thours: 23,\n\t\tminutes: 59,\n\t\tseconds: 59,\n\t\tmilliseconds: 999\n\t},\n\tpadValues: {\n\t\thours: 1,\n\t\tminutes: 2,\n\t\tseconds: 2,\n\t\tmilliseconds: 3\n\t},\n\tincrease: function( type ){\n\t\tvar value = parseInt(this.state[ type ]) + 1;\n\t\tif( value > this.maxValues[ type ] )\n\t\t\tvalue = 0;\n\t\treturn this.pad( type, value );\n\t},\n\tdecrease: function( type ){\n\t\tvar value = parseInt(this.state[ type ]) - 1;\n\t\tif( value < 0 )\n\t\t\tvalue = this.maxValues[ type ];\n\t\treturn this.pad( type, value );\n\t},\n\tpad: function( type, value ){\n\t\tvar str = value + '';\n\t\twhile( str.length < this.padValues[ type ] )\n\t\t\tstr = '0' + str;\n\t\treturn str;\n\t}\n});\n\nmodule.exports = DateTimePickerTime;\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?");

@@ -108,0 +108,0 @@ /***/ },

/*
react-datetime v2.3.2
react-datetime v2.3.3
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("React"),require("moment"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","moment","ReactDOM"],e):"object"==typeof exports?exports.Datetime=e(require("React"),require("moment"),require("ReactDOM")):t.Datetime=e(t.React,t.moment,t.ReactDOM)}(this,function(t,e,s){return function(t){function e(a){if(s[a])return s[a].exports;var r=s[a]={exports:{},id:a,loaded:!1};return t[a].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 a=s(1),r=s(2),n=s(3),i=s(5),o=s(6),c=s(7),p=s(4),d=r.PropTypes,u=r.createClass({mixins:[s(8)],viewComponents:{days:n,months:i,years:o,time:c},propTypes:{closeOnSelect:d.bool,onFocus:d.func,onBlur:d.func,onChange:d.func,locale:d.string,input:d.bool,inputProps:d.object,viewMode:d.oneOf(["years","months","days","time"]),isValidDate:d.func,open:d.bool,strictParsing:d.bool},getDefaultProps:function(){var t=function(){};return{className:"",defaultValue:"",inputProps:{},input:!0,onFocus:t,onBlur:t,onChange:t,timeFormat:!0,dateFormat:!0,strictParsing:!0}},getInitialState:function(){var t=this.getStateFromProps(this.props);return void 0==t.open&&(t.open=!this.props.input),t.currentView=this.props.dateFormat?this.props.viewMode||t.updateOn||"days":"time",t},getStateFromProps:function(t){var e,s,a,r=this.getFormats(t),n=t.value||t.defaultValue;return n&&"string"==typeof n?e=this.localMoment(n,r.datetime):n&&(e=this.localMoment(n)),e&&!e.isValid()&&(e=null),s=e?e.clone().startOf("month"):this.localMoment().startOf("month"),a=this.getUpdateOn(r),{updateOn:a,inputFormat:r.datetime,viewDate:s,selectedDate:e,inputValue:e?e.format(r.datetime):n||"",open:t.open}},getUpdateOn:function(t){return t.date.match(/[lLD]/)?"days":-1!=t.date.indexOf("M")?"months":-1!=t.date.indexOf("Y")?"years":"days"},getFormats:function(t){var e={date:t.dateFormat||"",time:t.timeFormat||""},s=this.localMoment(t.date).localeData();return e.date===!0?e.date=s.longDateFormat("L"):"days"!==this.getUpdateOn(e)&&(e.time=""),e.time===!0&&(e.time=s.longDateFormat("LT")),e.datetime=e.date&&e.time?e.date+" "+e.time:e.date||e.time,e},componentWillReceiveProps:function(t){var e=this.getFormats(t),s={};t.value!=this.props.value&&(s=this.getStateFromProps(t)),e.datetime!==this.getFormats(this.props).datetime&&(s.inputFormat=e.datetime),void 0===s.open&&(this.props.closeOnSelect&&"time"!==this.state.currentView?s.open=!1:s.open=this.state.open),this.setState(s)},onInputChange:function(t){var e=null==t.target?t:t.target.value,s=this.localMoment(e,this.state.inputFormat),a={inputValue:e};return s.isValid()&&!this.props.value?(a.selectedDate=s,a.viewDate=s.clone().startOf("month")):a.selectedDate=null,this.setState(a,function(){return this.props.onChange(s.isValid()?s:this.state.inputValue)})},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(a){e.setState({viewDate:e.state.viewDate.clone()[t](parseInt(a.target.getAttribute("data-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,a){var r=this;return function(){var n={},i=a?"selectedDate":"viewDate";n[i]=r.state[i].clone()[t](e,s),r.setState(n)}},allowedSetTime:["hours","minutes","seconds","milliseconds"],setTime:function(t,e){var s,a=this.allowedSetTime.indexOf(t)+1,r=this.state,n=(r.selectedDate||r.viewDate).clone();for(n[t](e);a<this.allowedSetTime.length;a++)s=this.allowedSetTime[a],n[s](n[s]());this.props.value||this.setState({selectedDate:n,inputValue:n.format(r.inputFormat)}),this.props.onChange(n)},updateSelectedDate:function(t,e){var s,a=t.target,r=0,n=this.state.viewDate,i=this.state.selectedDate||n;-1!=a.className.indexOf("rdtDay")?(-1!=a.className.indexOf("rdtNew")?r=1:-1!=a.className.indexOf("rdtOld")&&(r=-1),s=n.clone().month(n.month()+r).date(parseInt(a.getAttribute("data-value")))):-1!=a.className.indexOf("rdtMonth")?s=n.clone().month(parseInt(a.getAttribute("data-value"))).date(i.date()):-1!=a.className.indexOf("rdtYear")&&(s=n.clone().month(i.month()).date(i.date()).year(parseInt(a.getAttribute("data-value")))),s.hours(i.hours()).minutes(i.minutes()).seconds(i.seconds()).milliseconds(i.milliseconds()),this.props.value?this.props.closeOnSelect&&e&&this.closeCalendar():this.setState({selectedDate:s,viewDate:s.clone().startOf("month"),inputValue:s.format(this.state.inputFormat),open:!(this.props.closeOnSelect&&e)}),this.props.onChange(s)},openCalendar:function(){this.state.open||(this.props.onFocus(),this.setState({open:!0}))},closeCalendar:function(){this.setState({open:!1}),this.props.onBlur(this.state.selectedDate||this.state.inputValue)},handleClickOutside:function(){this.props.input&&this.state.open&&!this.props.open&&(this.setState({open:!1}),this.props.onBlur(this.state.selectedDate||this.state.inputValue))},localMoment:function(t,e){var s=p(t,e,this.props.strictParsing);return this.props.locale&&s.locale(this.props.locale),s},componentProps:{fromProps:["value","isValidDate","renderDay","renderMonth","renderYear"],fromState:["viewDate","selectedDate","updateOn"],fromThis:["setDate","setTime","showView","addTime","subtractTime","updateSelectedDate","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 "+this.props.className,n=[];return this.props.input?n=[e.input(a({key:"i",type:"text",className:"form-control",onFocus:this.openCalendar,onChange:this.onInputChange,value:this.state.inputValue},this.props.inputProps))]:s+=" rdtStatic",this.state.open&&(s+=" rdtOpen"),e.div({className:s},n.concat(e.div({key:"dt",className:"rdtPicker"},r.createElement(t,this.getComponentProps()))))}});u.moment=p,t.exports=u},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 a(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,n,i=s(t),o=1;o<arguments.length;o++){r=arguments[o],n=a(Object(r));for(var c=0;c<n.length;c++)i[n[c]]=r[n[c]]}return i}},function(e,s){e.exports=t},function(t,e,s){var a=s(2),r=s(4),n=a.DOM,i=a.createClass({render:function(){var t,e=this.renderFooter(),s=this.props.viewDate,a=s.localeData();return t=[n.thead({key:"th"},[n.tr({key:"h"},[n.th({key:"p",className:"rdtPrev"},n.span({onClick:this.props.subtractTime(1,"months")},"‹")),n.th({key:"s",className:"rdtSwitch",onClick:this.props.showView("months"),colSpan:5,"data-value":this.props.viewDate.month()},a.months(s)+" "+s.year()),n.th({key:"n",className:"rdtNext"},n.span({onClick:this.props.addTime(1,"months")},"›"))]),n.tr({key:"d"},this.getDaysOfWeek(a).map(function(t,e){return n.th({key:t+e,className:"dow"},t)}))]),n.tbody({key:"tb"},this.renderDays())],e&&t.push(e),n.div({className:"rdtDays"},n.table({},t))},getDaysOfWeek:function(t){var e=t._weekdaysMin,s=t.firstDayOfWeek(),a=[],r=0;return e.forEach(function(t){a[(7+r++-s)%7]=t}),a},renderDays:function(){var t,e,s,a,i=this.props.viewDate,o=this.props.selectedDate&&this.props.selectedDate.clone(),c=i.clone().subtract(1,"months"),p=i.year(),d=i.month(),u=[],l=[],h=this.props.renderDay||this.renderDay,m=this.props.isValidDate||this.isValidDate;c.date(c.daysInMonth()).startOf("week");for(var f=c.clone().add(42,"d");c.isBefore(f);)t="rdtDay",a=c.clone(),c.year()==p&&c.month()<d||c.year()<p?t+=" rdtOld":(c.year()==p&&c.month()>d||c.year()>p)&&(t+=" rdtNew"),o&&c.isSame(o,"day")&&(t+=" rdtActive"),c.isSame(r(),"day")&&(t+=" rdtToday"),e=!m(a,o),e&&(t+=" rdtDisabled"),s={key:c.format("M_D"),"data-value":c.date(),className:t},e||(s.onClick=this.updateSelectedDate),l.push(h(s,a,o)),7==l.length&&(u.push(n.tr({key:c.format("M_D")},l)),l=[]),c.add(1,"d");return u},updateSelectedDate:function(t){this.props.updateSelectedDate(t,!0)},renderDay:function(t,e,s){return n.td(t,e.date())},renderFooter:function(){if(!this.props.timeFormat)return"";var t=this.props.selectedDate||this.props.viewDate;return n.tfoot({key:"tf"},n.tr({},n.td({onClick:this.props.showView("time"),colSpan:7,className:"rdtTimeToggle"},t.format(this.props.timeFormat))))},isValidDate:function(){return 1}});t.exports=i},function(t,s){t.exports=e},function(t,e,s){"use strict";var a=s(2),r=(s(4),a.DOM),n=a.createClass({render:function(){return r.div({className:"rdtMonths"},[r.table({key:"a"},r.thead({},r.tr({},[r.th({key:"prev",className:"rdtPrev"},r.span({onClick:this.props.subtractTime(1,"years")},"‹")),r.th({key:"year",className:"rdtSwitch",onClick:this.props.showView("years"),colSpan:2,"data-value":this.props.viewDate.year()},this.props.viewDate.year()),r.th({key:"next",className:"rdtNext"},r.span({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,a=this.props.viewDate.month(),n=this.props.viewDate.year(),i=[],o=0,c=[],p=this.props.renderMonth||this.renderMonth;12>o;)t="rdtMonth",s&&o===a&&n===s.year()&&(t+=" rdtActive"),e={key:o,"data-value":o,className:t,onClick:"months"==this.props.updateOn?this.updateSelectedMonth:this.props.setDate("month")},c.push(p(e,o,n,s&&s.clone())),4==c.length&&(i.push(r.tr({key:a+"_"+i.length},c)),c=[]),o++;return i},updateSelectedMonth:function(t){this.props.updateSelectedDate(t,!0)},renderMonth:function(t,e,s,a){return r.td(t,this.props.viewDate.localeData()._monthsShort[e])}});t.exports=n},function(t,e,s){"use strict";var a=s(2),r=a.DOM,n=a.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:"rdtPrev"},r.span({onClick:this.props.subtractTime(10,"years")},"‹")),r.th({key:"year",className:"rdtSwitch",onClick:this.props.showView("years"),colSpan:2},t+"-"+(t+9)),r.th({key:"next",className:"rdtNext"},r.span({onClick:this.props.addTime(10,"years")},"›"))]))),r.table({key:"years"},r.tbody({},this.renderYears(t)))])},renderYears:function(t){var e,s,a=[],n=-1,i=[],o=this.props.renderYear||this.renderYear,c=this.props.selectedDate;for(t--;11>n;)e="rdtYear",-1===n|10===n&&(e+=" rdtOld"),c&&c.year()===t&&(e+=" rdtActive"),s={key:t,"data-value":t,className:e,onClick:"years"==this.props.updateOn?this.updateSelectedYear:this.props.setDate("year")},a.push(o(s,t,c&&c.clone())),4==a.length&&(i.push(r.tr({key:n},a)),a=[]),t++,n++;return i},updateSelectedYear:function(t){this.props.updateSelectedDate(t,!0)},renderYear:function(t,e,s){return r.td(t,e)}});t.exports=n},function(t,e,s){"use strict";var a=s(2),r=a.DOM,n=a.createClass({getInitialState:function(){return this.calculateState(this.props)},calculateState:function(t){var e=t.selectedDate||t.viewDate,s=t.timeFormat,a=[];(-1!=s.indexOf("H")||-1!=s.indexOf("h"))&&(a.push("hours"),-1!=s.indexOf("m")&&(a.push("minutes"),-1!=s.indexOf("s")&&a.push("seconds")));var r=!1;return-1!=this.props.timeFormat.indexOf(" A")&&null!=this.state&&(r=this.state.hours>12?"PM":"AM"),{hours:e.format("H"),minutes:e.format("mm"),seconds:e.format("ss"),milliseconds:e.format("SSS"),daypart:r,counters:a}},renderCounter:function(t){if("daypart"!==t){var e=this.state[t];return"hours"===t&&-1!=this.props.timeFormat.indexOf(" A")&&e>12&&(e-=12),r.div({key:t,className:"rdtCounter"},[r.span({key:"up",className:"rdtBtn",onMouseDown:this.onStartClicking("increase",t)},"▲"),r.div({key:"c",className:"rdtCount"},e),r.span({key:"do",className:"rdtBtn",onMouseDown:this.onStartClicking("decrease",t)},"▼")])}return""},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))}),this.state.daypart!==!1&&e.push(r.div({key:this.state.daypart,className:"rdtDayPart"},this.state.daypart)),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))))]))},componentWillReceiveProps:function(t,e){this.setState(this.calculateState(t))},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(){if(!this.props.dateFormat)return null;var t=this.props.selectedDate||this.props.viewDate;return r.thead({key:"h"},r.tr({},r.th({className:"rdtSwitch",colSpan:4,onClick:this.props.showView("days")},t.format(this.props.dateFormat))))},onStartClicking:function(t,e){var s=this;this.state[e];return function(){var a={};a[e]=s[t](e),s.setState(a),s.timer=setTimeout(function(){s.increaseTimer=setInterval(function(){a[e]=s[t](e),s.setState(a)},70)},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=n},function(t,e,s){var a=s(2),r=a.version&&a.version.split(".");r&&(r[0]>0||r[1]>13)&&(a=s(9));var n=[],i=[],o="ignore-react-onclickoutside",c=function(t,e){return t===e?!0:t.correspondingElement?t.correspondingElement.classList.contains(o):t.classList.contains(o)};t.exports={componentDidMount:function(){if("function"!=typeof this.handleClickOutside)throw new Error("Component lacks a handleClickOutside(event) function for processing outside click events.");var t=this.__outsideClickHandler=function(t,e){return function(s){s.stopPropagation();for(var a=s.target,r=!1;a.parentNode;){if(r=c(a,t))return;a=a.parentNode}e(s)}}(a.findDOMNode(this),this.handleClickOutside),e=n.length;n.push(this),i[e]=t,this.props.disableOnClickOutside||this.enableOnClickOutside()},componentWillUnmount:function(){this.disableOnClickOutside(),this.__outsideClickHandler=!1;var t=n.indexOf(this);t>-1&&i[t]&&(i.splice(t,1),n.splice(t,1))},enableOnClickOutside:function(){var t=this.__outsideClickHandler;document.addEventListener("mousedown",t),document.addEventListener("touchstart",t)},disableOnClickOutside:function(){var t=this.__outsideClickHandler;document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}},function(t,e){t.exports=s}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("React"),require("moment"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","moment","ReactDOM"],e):"object"==typeof exports?exports.Datetime=e(require("React"),require("moment"),require("ReactDOM")):t.Datetime=e(t.React,t.moment,t.ReactDOM)}(this,function(t,e,s){return function(t){function e(a){if(s[a])return s[a].exports;var r=s[a]={exports:{},id:a,loaded:!1};return t[a].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 a=s(1),r=s(2),n=s(3),i=s(5),o=s(6),c=s(7),p=s(4),d=r.PropTypes,u=r.createClass({mixins:[s(8)],viewComponents:{days:n,months:i,years:o,time:c},propTypes:{closeOnSelect:d.bool,onFocus:d.func,onBlur:d.func,onChange:d.func,locale:d.string,input:d.bool,inputProps:d.object,viewMode:d.oneOf(["years","months","days","time"]),isValidDate:d.func,open:d.bool,strictParsing:d.bool},getDefaultProps:function(){var t=function(){};return{className:"",defaultValue:"",inputProps:{},input:!0,onFocus:t,onBlur:t,onChange:t,timeFormat:!0,dateFormat:!0,strictParsing:!0}},getInitialState:function(){var t=this.getStateFromProps(this.props);return void 0==t.open&&(t.open=!this.props.input),t.currentView=this.props.dateFormat?this.props.viewMode||t.updateOn||"days":"time",t},getStateFromProps:function(t){var e,s,a,r=this.getFormats(t),n=t.value||t.defaultValue;return n&&"string"==typeof n?e=this.localMoment(n,r.datetime):n&&(e=this.localMoment(n)),e&&!e.isValid()&&(e=null),s=e?e.clone().startOf("month"):this.localMoment().startOf("month"),a=this.getUpdateOn(r),{updateOn:a,inputFormat:r.datetime,viewDate:s,selectedDate:e,inputValue:e?e.format(r.datetime):n||"",open:t.open}},getUpdateOn:function(t){return t.date.match(/[lLD]/)?"days":-1!=t.date.indexOf("M")?"months":-1!=t.date.indexOf("Y")?"years":"days"},getFormats:function(t){var e={date:t.dateFormat||"",time:t.timeFormat||""},s=this.localMoment(t.date).localeData();return e.date===!0?e.date=s.longDateFormat("L"):"days"!==this.getUpdateOn(e)&&(e.time=""),e.time===!0&&(e.time=s.longDateFormat("LT")),e.datetime=e.date&&e.time?e.date+" "+e.time:e.date||e.time,e},componentWillReceiveProps:function(t){var e=this.getFormats(t),s={};t.value!=this.props.value&&(s=this.getStateFromProps(t)),e.datetime!==this.getFormats(this.props).datetime&&(s.inputFormat=e.datetime),void 0===s.open&&(this.props.closeOnSelect&&"time"!==this.state.currentView?s.open=!1:s.open=this.state.open),this.setState(s)},onInputChange:function(t){var e=null==t.target?t:t.target.value,s=this.localMoment(e,this.state.inputFormat),a={inputValue:e};return s.isValid()&&!this.props.value?(a.selectedDate=s,a.viewDate=s.clone().startOf("month")):a.selectedDate=null,this.setState(a,function(){return this.props.onChange(s.isValid()?s:this.state.inputValue)})},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(a){e.setState({viewDate:e.state.viewDate.clone()[t](parseInt(a.target.getAttribute("data-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,a){var r=this;return function(){var n={},i=a?"selectedDate":"viewDate";n[i]=r.state[i].clone()[t](e,s),r.setState(n)}},allowedSetTime:["hours","minutes","seconds","milliseconds"],setTime:function(t,e){var s,a=this.allowedSetTime.indexOf(t)+1,r=this.state,n=(r.selectedDate||r.viewDate).clone();for(n[t](e);a<this.allowedSetTime.length;a++)s=this.allowedSetTime[a],n[s](n[s]());this.props.value||this.setState({selectedDate:n,inputValue:n.format(r.inputFormat)}),this.props.onChange(n)},updateSelectedDate:function(t,e){var s,a=t.target,r=0,n=this.state.viewDate,i=this.state.selectedDate||n;-1!=a.className.indexOf("rdtDay")?(-1!=a.className.indexOf("rdtNew")?r=1:-1!=a.className.indexOf("rdtOld")&&(r=-1),s=n.clone().month(n.month()+r).date(parseInt(a.getAttribute("data-value")))):-1!=a.className.indexOf("rdtMonth")?s=n.clone().month(parseInt(a.getAttribute("data-value"))).date(i.date()):-1!=a.className.indexOf("rdtYear")&&(s=n.clone().month(i.month()).date(i.date()).year(parseInt(a.getAttribute("data-value")))),s.hours(i.hours()).minutes(i.minutes()).seconds(i.seconds()).milliseconds(i.milliseconds()),this.props.value?this.props.closeOnSelect&&e&&this.closeCalendar():this.setState({selectedDate:s,viewDate:s.clone().startOf("month"),inputValue:s.format(this.state.inputFormat),open:!(this.props.closeOnSelect&&e)}),this.props.onChange(s)},openCalendar:function(){this.state.open||(this.props.onFocus(),this.setState({open:!0}))},closeCalendar:function(){this.setState({open:!1}),this.props.onBlur(this.state.selectedDate||this.state.inputValue)},handleClickOutside:function(){this.props.input&&this.state.open&&!this.props.open&&(this.setState({open:!1}),this.props.onBlur(this.state.selectedDate||this.state.inputValue))},localMoment:function(t,e){var s=p(t,e,this.props.strictParsing);return this.props.locale&&s.locale(this.props.locale),s},componentProps:{fromProps:["value","isValidDate","renderDay","renderMonth","renderYear"],fromState:["viewDate","selectedDate","updateOn"],fromThis:["setDate","setTime","showView","addTime","subtractTime","updateSelectedDate","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 "+this.props.className,n=[];return this.props.input?n=[e.input(a({key:"i",type:"text",className:"form-control",onFocus:this.openCalendar,onChange:this.onInputChange,value:this.state.inputValue},this.props.inputProps))]:s+=" rdtStatic",this.state.open&&(s+=" rdtOpen"),e.div({className:s},n.concat(e.div({key:"dt",className:"rdtPicker"},r.createElement(t,this.getComponentProps()))))}});u.moment=p,t.exports=u},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 a(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,n,i=s(t),o=1;o<arguments.length;o++){r=arguments[o],n=a(Object(r));for(var c=0;c<n.length;c++)i[n[c]]=r[n[c]]}return i}},function(e,s){e.exports=t},function(t,e,s){var a=s(2),r=s(4),n=a.DOM,i=a.createClass({render:function(){var t,e=this.renderFooter(),s=this.props.viewDate,a=s.localeData();return t=[n.thead({key:"th"},[n.tr({key:"h"},[n.th({key:"p",className:"rdtPrev"},n.span({onClick:this.props.subtractTime(1,"months")},"‹")),n.th({key:"s",className:"rdtSwitch",onClick:this.props.showView("months"),colSpan:5,"data-value":this.props.viewDate.month()},a.months(s)+" "+s.year()),n.th({key:"n",className:"rdtNext"},n.span({onClick:this.props.addTime(1,"months")},"›"))]),n.tr({key:"d"},this.getDaysOfWeek(a).map(function(t,e){return n.th({key:t+e,className:"dow"},t)}))]),n.tbody({key:"tb"},this.renderDays())],e&&t.push(e),n.div({className:"rdtDays"},n.table({},t))},getDaysOfWeek:function(t){var e=t._weekdaysMin,s=t.firstDayOfWeek(),a=[],r=0;return e.forEach(function(t){a[(7+r++-s)%7]=t}),a},renderDays:function(){var t,e,s,a,i=this.props.viewDate,o=this.props.selectedDate&&this.props.selectedDate.clone(),c=i.clone().subtract(1,"months"),p=i.year(),d=i.month(),u=[],l=[],h=this.props.renderDay||this.renderDay,m=this.props.isValidDate||this.isValidDate;c.date(c.daysInMonth()).startOf("week");for(var f=c.clone().add(42,"d");c.isBefore(f);)t="rdtDay",a=c.clone(),c.year()==p&&c.month()<d||c.year()<p?t+=" rdtOld":(c.year()==p&&c.month()>d||c.year()>p)&&(t+=" rdtNew"),o&&c.isSame(o,"day")&&(t+=" rdtActive"),c.isSame(r(),"day")&&(t+=" rdtToday"),e=!m(a,o),e&&(t+=" rdtDisabled"),s={key:c.format("M_D"),"data-value":c.date(),className:t},e||(s.onClick=this.updateSelectedDate),l.push(h(s,a,o)),7==l.length&&(u.push(n.tr({key:c.format("M_D")},l)),l=[]),c.add(1,"d");return u},updateSelectedDate:function(t){this.props.updateSelectedDate(t,!0)},renderDay:function(t,e,s){return n.td(t,e.date())},renderFooter:function(){if(!this.props.timeFormat)return"";var t=this.props.selectedDate||this.props.viewDate;return n.tfoot({key:"tf"},n.tr({},n.td({onClick:this.props.showView("time"),colSpan:7,className:"rdtTimeToggle"},t.format(this.props.timeFormat))))},isValidDate:function(){return 1}});t.exports=i},function(t,s){t.exports=e},function(t,e,s){"use strict";function a(t){return t.charAt(0).toUpperCase()+t.slice(1)}var r=s(2),n=(s(4),r.DOM),i=r.createClass({render:function(){return n.div({className:"rdtMonths"},[n.table({key:"a"},n.thead({},n.tr({},[n.th({key:"prev",className:"rdtPrev"},n.span({onClick:this.props.subtractTime(1,"years")},"‹")),n.th({key:"year",className:"rdtSwitch",onClick:this.props.showView("years"),colSpan:2,"data-value":this.props.viewDate.year()},this.props.viewDate.year()),n.th({key:"next",className:"rdtNext"},n.span({onClick:this.props.addTime(1,"years")},"›"))]))),n.table({key:"months"},n.tbody({key:"b"},this.renderMonths()))])},renderMonths:function(){for(var t,e,s=this.props.selectedDate,a=this.props.viewDate.month(),r=this.props.viewDate.year(),i=[],o=0,c=[],p=this.props.renderMonth||this.renderMonth;12>o;)t="rdtMonth",s&&o===a&&r===s.year()&&(t+=" rdtActive"),e={key:o,"data-value":o,className:t,onClick:"months"==this.props.updateOn?this.updateSelectedMonth:this.props.setDate("month")},c.push(p(e,o,r,s&&s.clone())),4==c.length&&(i.push(n.tr({key:a+"_"+i.length},c)),c=[]),o++;return i},updateSelectedMonth:function(t){this.props.updateSelectedDate(t,!0)},renderMonth:function(t,e,s,r){var i=this.props.viewDate.localeData()._monthsShort;return n.td(t,i.standalone?a(i.standalone[e]):i[e])}});t.exports=i},function(t,e,s){"use strict";var a=s(2),r=a.DOM,n=a.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:"rdtPrev"},r.span({onClick:this.props.subtractTime(10,"years")},"‹")),r.th({key:"year",className:"rdtSwitch",onClick:this.props.showView("years"),colSpan:2},t+"-"+(t+9)),r.th({key:"next",className:"rdtNext"},r.span({onClick:this.props.addTime(10,"years")},"›"))]))),r.table({key:"years"},r.tbody({},this.renderYears(t)))])},renderYears:function(t){var e,s,a=[],n=-1,i=[],o=this.props.renderYear||this.renderYear,c=this.props.selectedDate;for(t--;11>n;)e="rdtYear",-1===n|10===n&&(e+=" rdtOld"),c&&c.year()===t&&(e+=" rdtActive"),s={key:t,"data-value":t,className:e,onClick:"years"==this.props.updateOn?this.updateSelectedYear:this.props.setDate("year")},a.push(o(s,t,c&&c.clone())),4==a.length&&(i.push(r.tr({key:n},a)),a=[]),t++,n++;return i},updateSelectedYear:function(t){this.props.updateSelectedDate(t,!0)},renderYear:function(t,e,s){return r.td(t,e)}});t.exports=n},function(t,e,s){"use strict";var a=s(2),r=a.DOM,n=a.createClass({getInitialState:function(){return this.calculateState(this.props)},calculateState:function(t){var e=t.selectedDate||t.viewDate,s=t.timeFormat,a=[];(-1!=s.indexOf("H")||-1!=s.indexOf("h"))&&(a.push("hours"),-1!=s.indexOf("m")&&(a.push("minutes"),-1!=s.indexOf("s")&&a.push("seconds")));var r=!1;return-1!=this.props.timeFormat.indexOf(" A")&&null!=this.state&&(r=this.state.hours>=12?"PM":"AM"),{hours:e.format("H"),minutes:e.format("mm"),seconds:e.format("ss"),milliseconds:e.format("SSS"),daypart:r,counters:a}},renderCounter:function(t){if("daypart"!==t){var e=this.state[t];return"hours"===t&&-1!=this.props.timeFormat.indexOf(" A")&&e>12&&(e>12&&(e-=12),0==e&&(e=12)),r.div({key:t,className:"rdtCounter"},[r.span({key:"up",className:"rdtBtn",onMouseDown:this.onStartClicking("increase",t)},"▲"),r.div({key:"c",className:"rdtCount"},e),r.span({key:"do",className:"rdtBtn",onMouseDown:this.onStartClicking("decrease",t)},"▼")])}return""},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))}),this.state.daypart!==!1&&e.push(r.div({key:this.state.daypart,className:"rdtDayPart"},this.state.daypart)),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))))]))},componentWillReceiveProps:function(t,e){this.setState(this.calculateState(t))},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(){if(!this.props.dateFormat)return null;var t=this.props.selectedDate||this.props.viewDate;return r.thead({key:"h"},r.tr({},r.th({className:"rdtSwitch",colSpan:4,onClick:this.props.showView("days")},t.format(this.props.dateFormat))))},onStartClicking:function(t,e){var s=this;this.state[e];return function(){var a={};a[e]=s[t](e),s.setState(a),s.timer=setTimeout(function(){s.increaseTimer=setInterval(function(){a[e]=s[t](e),s.setState(a)},70)},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=n},function(t,e,s){var a=s(2),r=a.version&&a.version.split(".");r&&(r[0]>0||r[1]>13)&&(a=s(9));var n=[],i=[],o="ignore-react-onclickoutside",c=function(t,e){return t===e?!0:t.correspondingElement?t.correspondingElement.classList.contains(o):t.classList.contains(o)};t.exports={componentDidMount:function(){if("function"!=typeof this.handleClickOutside)throw new Error("Component lacks a handleClickOutside(event) function for processing outside click events.");var t=this.__outsideClickHandler=function(t,e){return function(s){s.stopPropagation();for(var a=s.target,r=!1;a.parentNode;){if(r=c(a,t))return;a=a.parentNode}e(s)}}(a.findDOMNode(this),this.handleClickOutside),e=n.length;n.push(this),i[e]=t,this.props.disableOnClickOutside||this.enableOnClickOutside()},componentWillUnmount:function(){this.disableOnClickOutside(),this.__outsideClickHandler=!1;var t=n.indexOf(this);t>-1&&i[t]&&(i.splice(t,1),n.splice(t,1))},enableOnClickOutside:function(){var t=this.__outsideClickHandler;document.addEventListener("mousedown",t),document.addEventListener("touchstart",t)},disableOnClickOutside:function(){var t=this.__outsideClickHandler;document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}},function(t,e){t.exports=s}])});
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')
);
{
"name": "react-datetime",
"version": "2.3.2",
"version": "2.3.3",
"description": "A lightweight but complete datetime picker React.js component.",

@@ -12,3 +12,4 @@ "homepage": "https://github.com/arqex/react-datetime",

"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",

@@ -15,0 +16,0 @@ "dev": "webpack-dev-server --config example/webpack.config.js --devtool eval --progress --colors --hot --content-base example"

@@ -15,5 +15,5 @@ react-datetime

Installation :
Installation:
```
npm install react-datetime
npm install --save react-datetime
```

@@ -33,6 +33,16 @@

```
[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

@@ -39,0 +49,0 @@ ===============================

@@ -61,6 +61,14 @@ 'use strict';

renderMonth: function( props, month, year, selectedDate ) {
return DOM.td( props, this.props.viewDate.localeData()._monthsShort[ month ] );
var monthsShort = this.props.viewDate.localeData()._monthsShort
return DOM.td( props, monthsShort.standalone
? capitalize( monthsShort.standalone[ month ] )
: monthsShort[ month ]
)
}
});
function capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1)
}
module.exports = DateTimePickerMonths;

@@ -28,3 +28,3 @@ 'use strict';

if( this.props.timeFormat.indexOf(' A') != -1 && this.state != null ){
daypart = ( this.state.hours > 12 ) ? 'PM' : 'AM';
daypart = ( this.state.hours >= 12 ) ? 'PM' : 'AM';
}

@@ -45,3 +45,8 @@

if (type === 'hours' && this.props.timeFormat.indexOf(' A') != -1 && value > 12) {
value = value - 12;
if(value > 12){
value = value - 12;
}
if(value == 0) {
value = 12;
}
}

@@ -48,0 +53,0 @@ return DOM.div({ key: type, className: 'rdtCounter'}, [

@@ -536,3 +536,3 @@ // Create the dom before requiring react

done();
}, 700 );
}, 920 );
});

@@ -550,3 +550,3 @@

done();
}, 700 );
}, 920 );
});

@@ -553,0 +553,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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