|
1 | 1 | /* |
2 | | -react-datetime v2.16.1 |
| 2 | +react-datetime v2.16.2 |
3 | 3 | https://github.com/YouCanBookMe/react-datetime |
4 | 4 | MIT: https://github.com/YouCanBookMe/react-datetime/raw/master/LICENSE |
5 | 5 | */ |
@@ -115,6 +115,8 @@ return /******/ (function(modules) { // webpackBootstrap |
115 | 115 | state.currentView = this.props.dateFormat ? |
116 | 116 | (this.props.viewMode || state.updateOn || viewModes.DAYS) : viewModes.TIME; |
117 | 117 |
|
| 118 | + this.checkTZ( this.props ); |
| 119 | + |
118 | 120 | return state; |
119 | 121 | }, |
120 | 122 |
|
@@ -268,13 +270,9 @@ return /******/ (function(modules) { // webpackBootstrap |
268 | 270 | if ( nextProps.viewDate !== this.props.viewDate ) { |
269 | 271 | updatedState.viewDate = moment(nextProps.viewDate); |
270 | 272 | } |
271 | | - //we should only show a valid date if we are provided a isValidDate function. Removed in 2.10.3 |
272 | | - /*if (this.props.isValidDate) { |
273 | | - updatedState.viewDate = updatedState.viewDate || this.state.viewDate; |
274 | | - while (!this.props.isValidDate(updatedState.viewDate)) { |
275 | | - updatedState.viewDate = updatedState.viewDate.add(1, 'day'); |
276 | | - } |
277 | | - }*/ |
| 273 | + |
| 274 | + this.checkTZ( nextProps ); |
| 275 | + |
278 | 276 | this.setState( updatedState ); |
279 | 277 | }, |
280 | 278 |
|
@@ -469,6 +467,15 @@ return /******/ (function(modules) { // webpackBootstrap |
469 | 467 | return m; |
470 | 468 | }, |
471 | 469 |
|
| 470 | + checkTZ: function( props ) { |
| 471 | + var con = console; |
| 472 | + |
| 473 | + if ( props.displayTimeZone && !this.tzWarning && !moment.tz ) { |
| 474 | + this.tzWarning = true; |
| 475 | + con && con.error('react-datetime: displayTimeZone prop with value "' + props.displayTimeZone + '" is used but moment.js timezone is not loaded.'); |
| 476 | + } |
| 477 | + }, |
| 478 | + |
472 | 479 | componentProps: { |
473 | 480 | fromProps: ['value', 'isValidDate', 'renderDay', 'renderMonth', 'renderYear', 'timeConstraints'], |
474 | 481 | fromState: ['viewDate', 'selectedDate', 'updateOn'], |
@@ -534,7 +541,7 @@ return /******/ (function(modules) { // webpackBootstrap |
534 | 541 | onKeyDown: this.overrideEvent( 'onKeyDown', this.onInputKey ), |
535 | 542 | } |
536 | 543 | ); |
537 | | - |
| 544 | + |
538 | 545 | if ( this.props.renderInput ) { |
539 | 546 | children = [ React.createElement('div', { key: 'i' }, this.props.renderInput( finalInputProps, this.openCalendar, this.closeCalendar )) ]; |
540 | 547 | } else { |
|
0 commit comments