react-datetime = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '% s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0; this.state = initialState; }
n/a
CalendarContainer = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '% s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0; this.state = initialState; }
n/a
DaysView = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null ', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
n/a
MonthsView = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null ', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
n/a
TimeView = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null ', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
n/a
YearsView = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null ', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
n/a
getDefaultProps = function () { var nof = function() {}; return { className: '', defaultValue: '', inputProps: {}, input: true, onFocus: nof, onBlur: nof, onChange: nof, timeFormat: true, timeConstraints: {}, dateFormat: true, strictParsing: true, closeOnSelect: false, closeOnTab: true, utc: false }; }
n/a
function hooks() { return hookCallback.apply(null, arguments); }
...
## Selectable Dates
It is possible to disable dates in the calendar if the user are not allowed to select them, e.g. dates in the past. This is done
using the prop `isValidDate`, which admits a function in the form `function(currentDate, selectedDate)` where both arguments are
[moment objects](http://momentjs.com). The function shall return `true` for selectable dates, and `false` for disabled ones.
In the example below are *all dates before today* disabled.
```js
// Let's use the static moment reference in the Datetime component
var yesterday = Datetime.moment().subtract( 1, 'day' );
var valid = function( current ){
return current.isAfter( yesterday );
};
<Datetime isValidDate={ valid } />
```
[Working example of disabled days here.](http://codepen.io/simeg/pen/XNNYJg)
...
function createDuration(input, key) { var duration = input, // matching against regexp is expensive, do it on demand match = null, sign, ret, diffRes; if (isDuration(input)) { duration = { ms : input._milliseconds, d : input._days, M : input._months }; } else if (isNumber(input)) { duration = {}; if (key) { duration[key] = input; } else { duration.milliseconds = input; } } else if (!!(match = aspNetRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : 0, d : toInt(match[DATE]) * sign, h : toInt(match[HOUR]) * sign, m : toInt(match[MINUTE]) * sign, s : toInt(match[SECOND]) * sign, ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match }; } else if (!!(match = isoRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : parseIso(match[2], sign), M : parseIso(match[3], sign), w : parseIso(match[4], sign), d : parseIso(match[5], sign), h : parseIso(match[6], sign), m : parseIso(match[7], sign), s : parseIso(match[8], sign) }; } else if (duration == null) {// checks for null or undefined duration = {}; } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); duration = {}; duration.ms = diffRes.milliseconds; duration.M = diffRes.months; } ret = new Duration(duration); if (isDuration(input) && hasOwnProp(input, '_locale')) { ret._locale = input._locale; } return ret; }
n/a
propTypes.inputProps = function () { [native code] }
n/a
propTypes.locale = function () { [native code] }
n/a
propTypes.onFocus = function () { [native code] }
n/a
propTypes.utc = function () { [native code] }
n/a
propTypes.viewMode = function () { [native code] }
n/a
CalendarContainer = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '% s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0; this.state = initialState; }
n/a
constructor = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '% s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0; this.state = initialState; }
n/a
render = function () { return React.createElement( this.viewComponents[ this.props.view ], this.props.viewProps ); }
n/a
DaysView = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null ', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
n/a
getClass = function () { if (Component.getClass) { return Component.getClass(); } return Component; }
n/a
getDefaultProps = function () { return { excludeScrollbar: config && config.excludeScrollbar }; }
n/a
__outsideClickHandler = function () {}
n/a
function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }
n/a
componentWillReceiveProps = function (nextProps) { if (this.props.disableOnClickOutside && !nextProps.disableOnClickOutside) { this.enableOnClickOutside(); } else if (!this.props.disableOnClickOutside && nextProps.disableOnClickOutside) { this.disableOnClickOutside(); } }
n/a
function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }
n/a
constructor = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null ', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
n/a
disableOnClickOutside = function () { var fn = this.__outsideClickHandler; if (typeof document !== 'undefined') { var events = this.props.eventTypes || DEFAULT_EVENTS; if (!events.forEach) { events = [events]; } events.forEach(function (eventName) { document.removeEventListener(eventName, fn); }); } }
n/a
enableOnClickOutside = function () { var fn = this.__outsideClickHandler; if (typeof document !== 'undefined') { var events = this.props.eventTypes || DEFAULT_EVENTS; if (!events.forEach) { events = [events]; } events.forEach(function (eventName) { document.addEventListener(eventName, fn); }); } }
n/a
getInstance = function () { return Component.prototype.isReactComponent ? this.refs.instance : this; }
n/a
render = function () { var passedProps = this.props; var props = {}; Object.keys(this.props).forEach(function(key) { if (key !== 'excludeScrollbar') { props[key] = passedProps[key]; } }); if (Component.prototype.isReactComponent) { props.ref = 'instance'; } props.disableOnClickOutside = this.disableOnClickOutside; props.enableOnClickOutside = this.enableOnClickOutside; return React.createElement(Component, props); }
n/a
MonthsView = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null ', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
n/a
getClass = function () { if (Component.getClass) { return Component.getClass(); } return Component; }
n/a
getDefaultProps = function () { return { excludeScrollbar: config && config.excludeScrollbar }; }
n/a
__outsideClickHandler = function () {}
n/a
function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }
n/a
componentWillReceiveProps = function (nextProps) { if (this.props.disableOnClickOutside && !nextProps.disableOnClickOutside) { this.enableOnClickOutside(); } else if (!this.props.disableOnClickOutside && nextProps.disableOnClickOutside) { this.disableOnClickOutside(); } }
n/a
function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }
n/a
constructor = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null ', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
n/a
disableOnClickOutside = function () { var fn = this.__outsideClickHandler; if (typeof document !== 'undefined') { var events = this.props.eventTypes || DEFAULT_EVENTS; if (!events.forEach) { events = [events]; } events.forEach(function (eventName) { document.removeEventListener(eventName, fn); }); } }
n/a
enableOnClickOutside = function () { var fn = this.__outsideClickHandler; if (typeof document !== 'undefined') { var events = this.props.eventTypes || DEFAULT_EVENTS; if (!events.forEach) { events = [events]; } events.forEach(function (eventName) { document.addEventListener(eventName, fn); }); } }
n/a
getInstance = function () { return Component.prototype.isReactComponent ? this.refs.instance : this; }
n/a
render = function () { var passedProps = this.props; var props = {}; Object.keys(this.props).forEach(function(key) { if (key !== 'excludeScrollbar') { props[key] = passedProps[key]; } }); if (Component.prototype.isReactComponent) { props.ref = 'instance'; } props.disableOnClickOutside = this.disableOnClickOutside; props.enableOnClickOutside = this.enableOnClickOutside; return React.createElement(Component, props); }
n/a
TimeView = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null ', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
n/a
getClass = function () { if (Component.getClass) { return Component.getClass(); } return Component; }
n/a
getDefaultProps = function () { return { excludeScrollbar: config && config.excludeScrollbar }; }
n/a
__outsideClickHandler = function () {}
n/a
function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }
n/a
componentWillReceiveProps = function (nextProps) { if (this.props.disableOnClickOutside && !nextProps.disableOnClickOutside) { this.enableOnClickOutside(); } else if (!this.props.disableOnClickOutside && nextProps.disableOnClickOutside) { this.disableOnClickOutside(); } }
n/a
function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }
n/a
constructor = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null ', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
n/a
disableOnClickOutside = function () { var fn = this.__outsideClickHandler; if (typeof document !== 'undefined') { var events = this.props.eventTypes || DEFAULT_EVENTS; if (!events.forEach) { events = [events]; } events.forEach(function (eventName) { document.removeEventListener(eventName, fn); }); } }
n/a
enableOnClickOutside = function () { var fn = this.__outsideClickHandler; if (typeof document !== 'undefined') { var events = this.props.eventTypes || DEFAULT_EVENTS; if (!events.forEach) { events = [events]; } events.forEach(function (eventName) { document.addEventListener(eventName, fn); }); } }
n/a
getInstance = function () { return Component.prototype.isReactComponent ? this.refs.instance : this; }
n/a
render = function () { var passedProps = this.props; var props = {}; Object.keys(this.props).forEach(function(key) { if (key !== 'excludeScrollbar') { props[key] = passedProps[key]; } }); if (Component.prototype.isReactComponent) { props.ref = 'instance'; } props.disableOnClickOutside = this.disableOnClickOutside; props.enableOnClickOutside = this.enableOnClickOutside; return React.createElement(Component, props); }
n/a
YearsView = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null ', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
n/a
getClass = function () { if (Component.getClass) { return Component.getClass(); } return Component; }
n/a
getDefaultProps = function () { return { excludeScrollbar: config && config.excludeScrollbar }; }
n/a
__outsideClickHandler = function () {}
n/a
function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }
n/a
componentWillReceiveProps = function (nextProps) { if (this.props.disableOnClickOutside && !nextProps.disableOnClickOutside) { this.enableOnClickOutside(); } else if (!this.props.disableOnClickOutside && nextProps.disableOnClickOutside) { this.disableOnClickOutside(); } }
n/a
function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }
n/a
constructor = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly . Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null ', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
n/a
disableOnClickOutside = function () { var fn = this.__outsideClickHandler; if (typeof document !== 'undefined') { var events = this.props.eventTypes || DEFAULT_EVENTS; if (!events.forEach) { events = [events]; } events.forEach(function (eventName) { document.removeEventListener(eventName, fn); }); } }
n/a
enableOnClickOutside = function () { var fn = this.__outsideClickHandler; if (typeof document !== 'undefined') { var events = this.props.eventTypes || DEFAULT_EVENTS; if (!events.forEach) { events = [events]; } events.forEach(function (eventName) { document.addEventListener(eventName, fn); }); } }
n/a
getInstance = function () { return Component.prototype.isReactComponent ? this.refs.instance : this; }
n/a
render = function () { var passedProps = this.props; var props = {}; Object.keys(this.props).forEach(function(key) { if (key !== 'excludeScrollbar') { props[key] = passedProps[key]; } }); if (Component.prototype.isReactComponent) { props.ref = 'instance'; } props.disableOnClickOutside = this.disableOnClickOutside; props.enableOnClickOutside = this.enableOnClickOutside; return React.createElement(Component, props); }
n/a
onBlur = function () {}
n/a
onChange = function () {}
n/a
onFocus = function () {}
n/a
function hooks() { return hookCallback.apply(null, arguments); }
...
## Selectable Dates
It is possible to disable dates in the calendar if the user are not allowed to select them, e.g. dates in the past. This is done
using the prop `isValidDate`, which admits a function in the form `function(currentDate, selectedDate)` where both arguments are
[moment objects](http://momentjs.com). The function shall return `true` for selectable dates, and `false` for disabled ones.
In the example below are *all dates before today* disabled.
```js
// Let's use the static moment reference in the Datetime component
var yesterday = Datetime.moment().subtract( 1, 'day' );
var valid = function( current ){
return current.isAfter( yesterday );
};
<Datetime isValidDate={ valid } />
```
[Working example of disabled days here.](http://codepen.io/simeg/pen/XNNYJg)
...
ISO_8601 = function () {}
n/a
RFC_2822 = function () {}
n/a
function getCalendarFormat(myMoment, now) { var diff = myMoment.diff(now, 'days', true); return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; }
n/a
createFromInputFallback = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function defineLocale(name, config) { if (config !== null) { var parentConfig = baseConfig; config.abbr = name; if (locales[name] != null) { deprecateSimple('defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); parentConfig = locales[name]._config; } else if (config.parentLocale != null) { if (locales[config.parentLocale] != null) { parentConfig = locales[config.parentLocale]._config; } else { if (!localeFamilies[config.parentLocale]) { localeFamilies[config.parentLocale] = []; } localeFamilies[config.parentLocale].push({ name: name, config: config }); return null; } } locales[name] = new Locale(mergeConfigs(parentConfig, config)); if (localeFamilies[name]) { localeFamilies[name].forEach(function (x) { defineLocale(x.name, x.config); }); } // backwards compat for now: also set the locale // make sure we set the locale AFTER all child locales have been // created, so we won't end up with the child locale set. getSetGlobalLocale(name); return locales[name]; } else { // useful for testing delete locales[name]; return null; } }
n/a
function createDuration(input, key) { var duration = input, // matching against regexp is expensive, do it on demand match = null, sign, ret, diffRes; if (isDuration(input)) { duration = { ms : input._milliseconds, d : input._days, M : input._months }; } else if (isNumber(input)) { duration = {}; if (key) { duration[key] = input; } else { duration.milliseconds = input; } } else if (!!(match = aspNetRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : 0, d : toInt(match[DATE]) * sign, h : toInt(match[HOUR]) * sign, m : toInt(match[MINUTE]) * sign, s : toInt(match[SECOND]) * sign, ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match }; } else if (!!(match = isoRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : parseIso(match[2], sign), M : parseIso(match[3], sign), w : parseIso(match[4], sign), d : parseIso(match[5], sign), h : parseIso(match[6], sign), m : parseIso(match[7], sign), s : parseIso(match[8], sign) }; } else if (duration == null) {// checks for null or undefined duration = {}; } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); duration = {}; duration.ms = diffRes.milliseconds; duration.M = diffRes.months; } ret = new Duration(duration); if (isDuration(input) && hasOwnProp(input, '_locale')) { ret._locale = input._locale; } return ret; }
n/a
function createInvalid(flags) { var m = createUTC(NaN); if (flags != null) { extend(getParsingFlags(m), flags); } else { getParsingFlags(m).userInvalidated = true; } return m; }
n/a
function isDate(input) { return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; }
n/a
function isDuration(obj) { return obj instanceof Duration; }
n/a
function isMoment(obj) { return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); }
n/a
lang = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
langData = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function getSetGlobalLocale(key, values) { var data; if (key) { if (isUndefined(values)) { data = getLocale(key); } else { data = defineLocale(key, values); } if (data) { // moment.duration._locale = moment._locale = data; globalLocale = data; } } return globalLocale._abbr; }
n/a
function getLocale(key) { var locale; if (key && key._locale && key._locale._abbr) { key = key._locale._abbr; } if (!key) { return globalLocale; } if (!isArray(key)) { //short-circuit everything else locale = loadLocale(key); if (locale) { return locale; } key = [key]; } return chooseLocale(key); }
...
;
var DOM = React.DOM;
var DateTimePickerDays = onClickOutside( React.createClass({
render: function() {
var footer = this.renderFooter(),
date = this.props.viewDate,
locale = date.localeData(),
tableChildren
;
tableChildren = [
DOM.thead({ key: 'th' }, [
DOM.tr({ key: 'h' }, [
DOM.th({ key: 'p', className: 'rdtPrev' }, DOM.span({ onClick: this.props.subtractTime( 1, 'months
' )}, '‹' )),
...
function listLocales() { return keys$1(locales); }
n/a
function max() { var args = [].slice.call(arguments, 0); return pickBy('isAfter', args); }
n/a
function min() { var args = [].slice.call(arguments, 0); return pickBy('isBefore', args); }
n/a
function listMonths(format, index) { return listMonthsImpl(format, index, 'months'); }
...
tableChildren
;
tableChildren = [
DOM.thead({ key: 'th' }, [
DOM.tr({ key: 'h' }, [
DOM.th({ key: 'p', className: 'rdtPrev' }, DOM.span({ onClick: this.props.subtractTime( 1, 'months
' )}, '‹' )),
DOM.th({ key: 's', className: 'rdtSwitch', onClick: this.props.showView( 'months' ), colSpan:
5, 'data-value': this.props.viewDate.month() }, locale.months( date ) + '
; ' + date.year() ),
DOM.th({ key: 'n', className: 'rdtNext' }, DOM.span({ onClick: this.props.addTime( 1, 'months'
; )}, '›' ))
]),
DOM.tr({ key: 'd'}, this.getDaysOfWeek( locale ).map( function( day, index ) { return DOM.th({ key: day + index, className
: 'dow'}, day ); }) )
]),
DOM.tbody({ key: 'tb' }, this.renderDays())
];
...
function listMonthsShort(format, index) { return listMonthsImpl(format, index, 'monthsShort'); }
...
updateSelectedMonth: function( event ) {
this.props.updateSelectedDate( event );
},
renderMonth: function( props, month ) {
var localMoment = this.props.viewDate;
var monthStr = localMoment.localeData().monthsShort( localMoment.month( month ) );
var strLength = 3;
// Because some months are up to 5 characters long, we want to
// use a fixed string length for consistency
var monthStrFixedLength = monthStr.substring( 0, strLength );
return DOM.td( props, capitalize( monthStrFixedLength ) );
},
...
function normalizeUnits(units) { return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; }
n/a
now = function () { return Date.now ? Date.now() : +(new Date()); }
n/a
parseTwoDigitYear = function (input) { return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); }
n/a
function createInZone() { return createLocal.apply(null, arguments).parseZone(); }
n/a
function getSetRelativeTimeRounding(roundingFunction) { if (roundingFunction === undefined) { return round; } if (typeof(roundingFunction) === 'function') { round = roundingFunction; return true; } return false; }
n/a
function getSetRelativeTimeThreshold(threshold, limit) { if (thresholds[threshold] === undefined) { return false; } if (limit === undefined) { return thresholds[threshold]; } thresholds[threshold] = limit; if (threshold === 's') { thresholds.ss = limit - 1; } return true; }
n/a
function createUnix(input) { return createLocal(input * 1000); }
n/a
function updateLocale(name, config) { if (config != null) { var locale, parentConfig = baseConfig; // MERGE if (locales[name] != null) { parentConfig = locales[name]._config; } config = mergeConfigs(parentConfig, config); locale = new Locale(config); locale.parentLocale = locales[name]; locales[name] = locale; // backwards compat for now: also set the locale getSetGlobalLocale(name); } else { // pass null for config to unupdate, useful for tests if (locales[name] != null) { if (locales[name].parentLocale != null) { locales[name] = locales[name].parentLocale; } else if (locales[name] != null) { delete locales[name]; } } } return locales[name]; }
n/a
updateOffset = function () {}
n/a
function createUTC(input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, true).utc(); }
n/a
function listWeekdays(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); }
n/a
function listWeekdaysMin(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); }
n/a
function listWeekdaysShort(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); }
n/a
function createDuration(input, key) { var duration = input, // matching against regexp is expensive, do it on demand match = null, sign, ret, diffRes; if (isDuration(input)) { duration = { ms : input._milliseconds, d : input._days, M : input._months }; } else if (isNumber(input)) { duration = {}; if (key) { duration[key] = input; } else { duration.milliseconds = input; } } else if (!!(match = aspNetRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : 0, d : toInt(match[DATE]) * sign, h : toInt(match[HOUR]) * sign, m : toInt(match[MINUTE]) * sign, s : toInt(match[SECOND]) * sign, ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match }; } else if (!!(match = isoRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : parseIso(match[2], sign), M : parseIso(match[3], sign), w : parseIso(match[4], sign), d : parseIso(match[5], sign), h : parseIso(match[6], sign), m : parseIso(match[7], sign), s : parseIso(match[8], sign) }; } else if (duration == null) {// checks for null or undefined duration = {}; } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); duration = {}; duration.ms = diffRes.milliseconds; duration.M = diffRes.months; } ret = new Duration(duration); if (isDuration(input) && hasOwnProp(input, '_locale')) { ret._locale = input._locale; } return ret; }
n/a
function createInvalid$1() { return createDuration(NaN); }
n/a
add = function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period ). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); tmp = val; val = period; period = tmp; } val = typeof val === 'string' ? +val : val; dur = createDuration(val, period); addSubtract(this, dur, direction); return this; }
...
renderer = this.props.renderDay || this.renderDay,
isValid = this.props.isValidDate || this.alwaysValidDate,
classes, isDisabled, dayProps, currentDate
;
// Go to the last week of the previous month
prevMonth.date( prevMonth.daysInMonth() ).startOf( 'week' );
var lastDay = prevMonth.clone().add( 42, 'd' );
while ( prevMonth.isBefore( lastDay ) ) {
classes = 'rdtDay';
currentDate = prevMonth.clone();
if ( ( prevMonth.year() === currentYear && prevMonth.month() < currentMonth ) || ( prevMonth.year() < currentYear
) )
classes += ' rdtOld';
...
function calendar$1(time, formats) { // We want to compare the start of today, vs this. // Getting start-of-today depends on whether we're local/utc/offset or not. var now = time || createLocal(), sod = cloneWithOffset(now, this).startOf('day'), format = hooks.calendarFormat(this, sod) || 'sameElse'; var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); return this.format(output || this.localeData().calendar(format, this, createLocal(now))); }
n/a
function clone() { return new Moment(this); }
...
});
return dow;
},
renderDays: function() {
var date = this.props.viewDate,
selected = this.props.selectedDate && this.props.selectedDate.clone(),
prevMonth = date.clone().subtract( 1, 'months' ),
currentYear = date.year(),
currentMonth = date.month(),
weeks = [],
days = [],
renderer = this.props.renderDay || this.renderDay,
isValid = this.props.isValidDate || this.alwaysValidDate,
...
function creationData() { return { input: this._i, format: this._f, locale: this._locale, isUTC: this._isUTC, strict: this._strict }; }
n/a
date = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
...
return <Datetime
renderDay={ this.renderDay }
renderMonth={ this.renderMonth }
renderYear={ this.renderYear }
/>;
},
renderDay: function( props, currentDate, selectedDate ){
return <td {...props}>{ '0' + currentDate.date() }</td
x3e;;
},
renderMonth: function( props, month, year, selectedDate ){
return <td {...props}>{ month }</td>;
},
renderYear: function( props, year, selectedDate ){
return <td {...props}>{ year % 100 }</td>;
}
...
dates = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function getSetDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); if (input != null) { input = parseWeekday(input, this.localeData()); return this.add(input - day, 'd'); } else { return day; } }
...
<Datetime isValidDate={ valid } />
```
[Working example of disabled days here.](http://codepen.io/simeg/pen/XNNYJg)
It's also possible to disable *the weekends*, as shown in the example below.
```js
var valid = function( current ){
return current.day() !== 0 && current.day() !== 6;
};
<Datetime isValidDate={ valid } />
```
[Working example of disabled weekends here.](http://codepen.io/simeg/pen/jVVKWq)
## Usage with TypeScript
...
function getSetDayOfYear(input) { var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); }
...
noOfDaysInYear = currentYear.endOf( 'year' ).format( 'DDD' );
daysInYear = Array.from({ length: noOfDaysInYear }, function( e, i ) {
return i + 1;
});
validDay = daysInYear.find(function( d ) {
var day = currentYear.clone().dayOfYear( d );
return isValid( day );
});
isDisabled = ( validDay === undefined );
if ( isDisabled )
classes += ' rdtDisabled';
...
function getSetDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); if (input != null) { input = parseWeekday(input, this.localeData()); return this.add(input - day, 'd'); } else { return day; } }
n/a
function getDaysInMonth() { return daysInMonth(this.year(), this.month()); }
...
days = [],
renderer = this.props.renderDay || this.renderDay,
isValid = this.props.isValidDate || this.alwaysValidDate,
classes, isDisabled, dayProps, currentDate
;
// Go to the last week of the previous month
prevMonth.date( prevMonth.daysInMonth() ).startOf( 'week' );
var lastDay = prevMonth.clone().add( 42, 'd' );
while ( prevMonth.isBefore( lastDay ) ) {
classes = 'rdtDay';
currentDate = prevMonth.clone();
if ( ( prevMonth.year() === currentYear && prevMonth.month() < currentMonth ) || ( prevMonth.year() < currentYear
) )
...
function diff(input, units, asFloat) { var that, zoneDelta, delta, output; if (!this.isValid()) { return NaN; } that = cloneWithOffset(input, this); if (!that.isValid()) { return NaN; } zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; units = normalizeUnits(units); if (units === 'year' || units === 'month' || units === 'quarter') { output = monthDiff(this, that); if (units === 'quarter') { output = output / 3; } else if (units === 'year') { output = output / 12; } } else { delta = this - that; output = units === 'second' ? delta / 1e3 : // 1000 units === 'minute' ? delta / 6e4 : // 1000 * 60 units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst delta; } return asFloat ? output : absFloor(output); }
n/a
function endOf(units) { units = normalizeUnits(units); if (units === undefined || units === 'millisecond') { return this; } // 'date' is an alias for 'day', so it should be considered as such. if (units === 'date') { units = 'day'; } return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); }
...
;
while (i < 12) {
classes = 'rdtMonth';
currentMonth =
this.props.viewDate.clone().set({ year: year, month: i, date: irrelevantDate });
noOfDaysInMonth = currentMonth.endOf( 'month' ).format( 'D' );
daysInMonth = Array.from({ length: noOfDaysInMonth }, function( e, i ) {
return i + 1;
});
validDay = daysInMonth.find(function( d ) {
var day = currentMonth.clone().set( 'date', d );
return isValid( day );
...
function format(inputString) { if (!inputString) { inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; } var output = formatMoment(this, inputString); return this.localeData().postformat(output); }
...
classes += ' rdtToday';
isDisabled = !isValid( currentDate, selected );
if ( isDisabled )
classes += ' rdtDisabled';
dayProps = {
key: prevMonth.format( 'M_D' ),
'data-value': prevMonth.date(),
className: classes
};
if ( !isDisabled )
dayProps.onClick = this.updateSelectedDate;
...
function from(time, withoutSuffix) { if (this.isValid() && ((isMoment(time) && time.isValid()) || createLocal(time).isValid())) { return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } }
...
while (i < 12) {
classes = 'rdtMonth';
currentMonth =
this.props.viewDate.clone().set({ year: year, month: i, date: irrelevantDate });
noOfDaysInMonth = currentMonth.endOf( 'month' ).format( 'D' );
daysInMonth = Array.from({ length: noOfDaysInMonth }, function( e, i ) {
return i + 1;
});
validDay = daysInMonth.find(function( d ) {
var day = currentMonth.clone().set( 'date', d );
return isValid( day );
});
...
function fromNow(withoutSuffix) { return this.from(createLocal(), withoutSuffix); }
n/a
function stringGet(units) { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](); } return this; }
n/a
function hasAlignedHourOffset(input) { if (!this.isValid()) { return false; } input = input ? createLocal(input).utcOffset() : 0; return (this.utcOffset() - input) % 60 === 0; }
n/a
hour = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
hours = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
function inspect() { if (!this.isValid()) { return 'moment.invalid(/* ' + this._i + ' */)'; } var func = 'moment'; var zone = ''; if (!this.isLocal()) { func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; zone = 'Z'; } var prefix = '[' + func + '("]'; var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY'; var datetime = '-MM-DD[T]HH:mm:ss.SSS'; var suffix = zone + '[")]'; return this.format(prefix + year + datetime + suffix); }
n/a
function invalidAt() { return getParsingFlags(this).overflow; }
n/a
function isAfter(input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); if (units === 'millisecond') { return this.valueOf() > localInput.valueOf(); } else { return localInput.valueOf() < this.clone().startOf(units).valueOf(); } }
...
In the example below are *all dates before today* disabled.
```js
// Let's use the static moment reference in the Datetime component
var yesterday = Datetime.moment().subtract( 1, 'day' );
var valid = function( current ){
return current.isAfter( yesterday );
};
<Datetime isValidDate={ valid } />
```
[Working example of disabled days here.](http://codepen.io/simeg/pen/XNNYJg)
It's also possible to disable *the weekends*, as shown in the example below.
```js
...
function isBefore(input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); if (units === 'millisecond') { return this.valueOf() < localInput.valueOf(); } else { return this.clone().endOf(units).valueOf() < localInput.valueOf(); } }
...
classes, isDisabled, dayProps, currentDate
;
// Go to the last week of the previous month
prevMonth.date( prevMonth.daysInMonth() ).startOf( 'week' );
var lastDay = prevMonth.clone().add( 42, 'd' );
while ( prevMonth.isBefore( lastDay ) ) {
classes = 'rdtDay';
currentDate = prevMonth.clone();
if ( ( prevMonth.year() === currentYear && prevMonth.month() < currentMonth ) || ( prevMonth.year() < currentYear
) )
classes += ' rdtOld';
else if ( ( prevMonth.year() === currentYear && prevMonth.month() > currentMonth ) || ( prevMonth.year() >
; currentYear ) )
classes += ' rdtNew';
...
function isBetween(from, to, units, inclusivity) { inclusivity = inclusivity || '()'; return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); }
n/a
function isDaylightSavingTime() { return ( this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset() ); }
n/a
isDSTShifted = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function getIsLeapYear() { return isLeapYear(this.year()); }
n/a
function isLocal() { return this.isValid() ? !this._isUTC : false; }
n/a
function isSame(input, units) { var localInput = isMoment(input) ? input : createLocal(input), inputMs; if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units || 'millisecond'); if (units === 'millisecond') { return this.valueOf() === localInput.valueOf(); } else { inputMs = localInput.valueOf(); return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); } }
...
currentDate = prevMonth.clone();
if ( ( prevMonth.year() === currentYear && prevMonth.month() < currentMonth ) || ( prevMonth.year() < currentYear
) )
classes += ' rdtOld';
else if ( ( prevMonth.year() === currentYear && prevMonth.month() > currentMonth ) || ( prevMonth.year() >
; currentYear ) )
classes += ' rdtNew';
if ( selected && prevMonth.isSame( selected, 'day' ) )
classes += ' rdtActive';
if ( prevMonth.isSame( moment(), 'day' ) )
classes += ' rdtToday';
isDisabled = !isValid( currentDate, selected );
if ( isDisabled )
...
function isSameOrAfter(input, units) { return this.isSame(input, units) || this.isAfter(input,units); }
n/a
function isSameOrBefore(input, units) { return this.isSame(input, units) || this.isBefore(input,units); }
n/a
function isUtc() { return this.isValid() ? this._isUTC && this._offset === 0 : false; }
n/a
function isUtc() { return this.isValid() ? this._isUTC && this._offset === 0 : false; }
n/a
function isUtcOffset() { return this.isValid() ? this._isUTC : false; }
n/a
function isValid$2() { return isValid(this); }
n/a
function getSetISOWeek(input) { var week = weekOfYear(this, 1, 4).week; return input == null ? week : this.add((input - week) * 7, 'd'); }
n/a
function getSetISOWeekYear(input) { return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4); }
n/a
function getSetISODayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } // behaves the same as moment#day except // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) // as a setter, sunday should belong to the previous week. if (input != null) { var weekday = parseIsoWeekday(input, this.localeData()); return this.day(this.day() % 7 ? weekday : weekday - 7); } else { return this.day() || 7; } }
n/a
function getSetISOWeek(input) { var week = weekOfYear(this, 1, 4).week; return input == null ? week : this.add((input - week) * 7, 'd'); }
n/a
function getISOWeeksInYear() { return weeksInYear(this.year(), 1, 4); }
n/a
lang = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function setOffsetToLocal(keepLocalTime) { if (this._isUTC) { this.utcOffset(0, keepLocalTime); this._isUTC = false; if (keepLocalTime) { this.subtract(getDateOffset(this), 'm'); } } return this; }
n/a
function locale(key) { var newLocaleData; if (key === undefined) { return this._locale._abbr; } else { newLocaleData = getLocale(key); if (newLocaleData != null) { this._locale = newLocaleData; } return this; } }
n/a
function localeData() { return this._locale; }
...
;
var DOM = React.DOM;
var DateTimePickerDays = onClickOutside( React.createClass({
render: function() {
var footer = this.renderFooter(),
date = this.props.viewDate,
locale = date.localeData(),
tableChildren
;
tableChildren = [
DOM.thead({ key: 'th' }, [
DOM.tr({ key: 'h' }, [
DOM.th({ key: 'p', className: 'rdtPrev' }, DOM.span({ onClick: this.props.subtractTime( 1, 'months
' )}, '‹' )),
...
max = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
millisecond = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
milliseconds = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
min = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
minute = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
minutes = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
function getSetMonth(value) { if (value != null) { setMonth(this, value); hooks.updateOffset(this, true); return this; } else { return get(this, 'Month'); } }
...
tableChildren
;
tableChildren = [
DOM.thead({ key: 'th' }, [
DOM.tr({ key: 'h' }, [
DOM.th({ key: 'p', className: 'rdtPrev' }, DOM.span({ onClick: this.props.subtractTime( 1, 'months
' )}, '‹' )),
DOM.th({ key: 's', className: 'rdtSwitch', onClick: this.props.showView( 'months' ), colSpan:
5, 'data-value': this.props.viewDate.month() }, locale.months( date ) + '
; ' + date.year() ),
DOM.th({ key: 'n', className: 'rdtNext' }, DOM.span({ onClick: this.props.addTime( 1, 'months'
; )}, '›' ))
]),
DOM.tr({ key: 'd'}, this.getDaysOfWeek( locale ).map( function( day, index ) { return DOM.th({ key: day + index, className
: 'dow'}, day ); }) )
]),
DOM.tbody({ key: 'tb' }, this.renderDays())
];
...
months = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
...
tableChildren
;
tableChildren = [
DOM.thead({ key: 'th' }, [
DOM.tr({ key: 'h' }, [
DOM.th({ key: 'p', className: 'rdtPrev' }, DOM.span({ onClick: this.props.subtractTime( 1, 'months
' )}, '‹' )),
DOM.th({ key: 's', className: 'rdtSwitch', onClick: this.props.showView( 'months' ), colSpan:
5, 'data-value': this.props.viewDate.month() }, locale.months( date ) + '
; ' + date.year() ),
DOM.th({ key: 'n', className: 'rdtNext' }, DOM.span({ onClick: this.props.addTime( 1, 'months'
; )}, '›' ))
]),
DOM.tr({ key: 'd'}, this.getDaysOfWeek( locale ).map( function( day, index ) { return DOM.th({ key: day + index, className
: 'dow'}, day ); }) )
]),
DOM.tbody({ key: 'tb' }, this.renderDays())
];
...
function setOffsetToParsedOffset() { if (this._tzm != null) { this.utcOffset(this._tzm, false, true); } else if (typeof this._i === 'string') { var tZone = offsetFromString(matchOffset, this._i); if (tZone != null) { this.utcOffset(tZone); } else { this.utcOffset(0, true); } } return this; }
n/a
function parsingFlags() { return extend({}, getParsingFlags(this)); }
n/a
function getSetQuarter(input) { return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); }
n/a
function getSetQuarter(input) { return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); }
n/a
second = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
seconds = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
function stringSet(units, value) { if (typeof units === 'object') { units = normalizeObjectUnits(units); var prioritized = getPrioritizedUnits(units); for (var i = 0; i < prioritized.length; i++) { this[prioritized[i].unit](units[prioritized[i].unit]); } } else { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](value); } } return this; }
...
// Date is irrelevant because we're only interested in month
irrelevantDate = 1
;
while (i < 12) {
classes = 'rdtMonth';
currentMonth =
this.props.viewDate.clone().set({ year: year, month: i, date: irrelevantDate });
noOfDaysInMonth = currentMonth.endOf( 'month' ).format( 'D' );
daysInMonth = Array.from({ length: noOfDaysInMonth }, function( e, i ) {
return i + 1;
});
validDay = daysInMonth.find(function( d ) {
...
function startOf(units) {
units = normalizeUnits(units);
// the following switch intentionally omits break keywords
// to utilize falling through the cases.
switch (units) {
case 'year':
this.month(0);
/* falls through */
case 'quarter':
case 'month':
this.date(1);
/* falls through */
case 'week':
case 'isoWeek':
case 'day':
case 'date':
this.hours(0);
/* falls through */
case 'hour':
this.minutes(0);
/* falls through */
case 'minute':
this.seconds(0);
/* falls through */
case 'second':
this.milliseconds(0);
}
// weeks are a special case
if (units === 'week') {
this.weekday(0);
}
if (units === 'isoWeek') {
this.isoWeekday(1);
}
// quarters are also special
if (units === 'quarter') {
this.month(Math.floor(this.month() / 3) * 3);
}
return this;
}
...
days = [],
renderer = this.props.renderDay || this.renderDay,
isValid = this.props.isValidDate || this.alwaysValidDate,
classes, isDisabled, dayProps, currentDate
;
// Go to the last week of the previous month
prevMonth.date( prevMonth.daysInMonth() ).startOf( 'week' );
var lastDay = prevMonth.clone().add( 42, 'd' );
while ( prevMonth.isBefore( lastDay ) ) {
classes = 'rdtDay';
currentDate = prevMonth.clone();
if ( ( prevMonth.year() === currentYear && prevMonth.month() < currentMonth ) || ( prevMonth.year() < currentYear
) )
...
subtract = function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period ). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); tmp = val; val = period; period = tmp; } val = typeof val === 'string' ? +val : val; dur = createDuration(val, period); addSubtract(this, dur, direction); return this; }
...
## Selectable Dates
It is possible to disable dates in the calendar if the user are not allowed to select them, e.g. dates in the past. This is done
using the prop `isValidDate`, which admits a function in the form `function(currentDate, selectedDate)` where both arguments are
[moment objects](http://momentjs.com). The function shall return `true` for selectable dates, and `false` for disabled ones.
In the example below are *all dates before today* disabled.
```js
// Let's use the static moment reference in the Datetime component
var yesterday = Datetime.moment().subtract( 1, 'day' );
var valid = function( current ){
return current.isAfter( yesterday );
};
<Datetime isValidDate={ valid } />
```
[Working example of disabled days here.](http://codepen.io/simeg/pen/XNNYJg)
...
function to(time, withoutSuffix) { if (this.isValid() && ((isMoment(time) && time.isValid()) || createLocal(time).isValid())) { return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } }
n/a
function toArray() { var m = this; return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; }
n/a
function toDate() { return new Date(this.valueOf()); }
n/a
function toISOString() { if (!this.isValid()) { return null; } var m = this.clone().utc(); if (m.year() < 0 || m.year() > 9999) { return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); } if (isFunction(Date.prototype.toISOString)) { // native implementation is ~50x faster, use it when we can return this.toDate().toISOString(); } return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); }
n/a
function toJSON() { // new Date(NaN).toJSON() === null return this.isValid() ? this.toISOString() : null; }
n/a
function toNow(withoutSuffix) { return this.to(createLocal(), withoutSuffix); }
n/a
function toObject() { var m = this; return { years: m.year(), months: m.month(), date: m.date(), hours: m.hours(), minutes: m.minutes(), seconds: m.seconds(), milliseconds: m.milliseconds() }; }
n/a
function toString() { return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); }
n/a
function unix() { return Math.floor(this.valueOf() / 1000); }
n/a
function setOffsetToUTC(keepLocalTime) { return this.utcOffset(0, keepLocalTime); }
n/a
function getSetOffset(input, keepLocalTime, keepMinutes) { var offset = this._offset || 0, localAdjust; if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { if (typeof input === 'string') { input = offsetFromString(matchShortOffset, input); if (input === null) { return this; } } else if (Math.abs(input) < 16 && !keepMinutes) { input = input * 60; } if (!this._isUTC && keepLocalTime) { localAdjust = getDateOffset(this); } this._offset = input; this._isUTC = true; if (localAdjust != null) { this.add(localAdjust, 'm'); } if (offset !== input) { if (!keepLocalTime || this._changeInProgress) { addSubtract(this, createDuration(input - offset, 'm'), 1, false); } else if (!this._changeInProgress) { this._changeInProgress = true; hooks.updateOffset(this, true); this._changeInProgress = null; } } return this; } else { return this._isUTC ? offset : getDateOffset(this); } }
n/a
function valueOf() { return this._d.valueOf() - ((this._offset || 0) * 60000); }
n/a
function getSetWeek(input) { var week = this.localeData().week(this); return input == null ? week : this.add((input - week) * 7, 'd'); }
n/a
function getSetWeekYear(input) { return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy); }
n/a
function getSetLocaleDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; return input == null ? weekday : this.add(input - weekday, 'd'); }
n/a
function getSetWeek(input) { var week = this.localeData().week(this); return input == null ? week : this.add((input - week) * 7, 'd'); }
n/a
function getWeeksInYear() { var weekInfo = this.localeData()._week; return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); }
n/a
year = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
...
tableChildren
;
tableChildren = [
DOM.thead({ key: 'th' }, [
DOM.tr({ key: 'h' }, [
DOM.th({ key: 'p', className: 'rdtPrev' }, DOM.span({ onClick: this.props.subtractTime( 1, 'months
' )}, '‹' )),
DOM.th({ key: 's', className: 'rdtSwitch', onClick: this.props.showView( 'months' ), colSpan:
5, 'data-value': this.props.viewDate.month() }, locale.months( date ) + ' ' + date.year() ),
DOM.th({ key: 'n', className: 'rdtNext' }, DOM.span({ onClick: this.props.addTime( 1, 'months'
; )}, '›' ))
]),
DOM.tr({ key: 'd'}, this.getDaysOfWeek( locale ).map( function( day, index ) { return DOM.th({ key: day + index, className
: 'dow'}, day ); }) )
]),
DOM.tbody({ key: 'tb' }, this.renderDays())
];
...
years = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
zone = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function getZoneAbbr() { return this._isUTC ? 'UTC' : ''; }
n/a
function getZoneName() { return this._isUTC ? 'Coordinated Universal Time' : ''; }
n/a
closeOnSelect = function () { [native code] }
n/a
closeOnTab = function () { [native code] }
n/a
input = function () { [native code] }
...
counters.push( me.renderDayPart() );
}
if ( this.state.counters.length === 3 && this.props.timeFormat.indexOf( 'S' ) !== -1 ) {
counters.push( DOM.div({ className: 'rdtCounterSeparator', key: 'sep5' }, ':' ) );
counters.push(
DOM.div({ className: 'rdtCounter rdtMilli', key: 'm' },
DOM.input({ value: this.state.milliseconds, type: 'text', onChange: this
.updateMilli } )
)
);
}
return DOM.div({ className: 'rdtTime' },
DOM.table({}, [
this.renderHeader(),
...
inputProps = function () { [native code] }
n/a
isValidDate = function () { [native code] }
n/a
locale = function () { [native code] }
n/a
onBlur = function () { [native code] }
n/a
onChange = function () { [native code] }
n/a
onFocus = function () { [native code] }
n/a
open = function () { [native code] }
n/a
strictParsing = function () { [native code] }
n/a
timeConstraints = function () { [native code] }
n/a
utc = function () { [native code] }
n/a
viewMode = function () { [native code] }
n/a
inputProps = function () { [native code] }
n/a
isRequired = function () { [native code] }
n/a
locale = function () { [native code] }
n/a
isRequired = function () { [native code] }
n/a
onFocus = function () { [native code] }
n/a
isRequired = function () { [native code] }
n/a
utc = function () { [native code] }
n/a
isRequired = function () { [native code] }
n/a
viewMode = function () { [native code] }
n/a
isRequired = function () { [native code] }
n/a