11/*
2- react-datetime v2.8.11
2+ react-datetime v2.10.0
33https://github.com/YouCanBookMe/react-datetime
44MIT: https://github.com/YouCanBookMe/react-datetime/raw/master/LICENSE
55*/
@@ -63,11 +63,11 @@ return /******/ (function(modules) { // webpackBootstrap
6363
6464 var assign = __webpack_require__ ( 1 ) ,
6565 PropTypes = __webpack_require__ ( 2 ) ,
66- createClass = __webpack_require__ ( 11 ) ,
66+ createClass = __webpack_require__ ( 11 ) ,
6767 moment = __webpack_require__ ( 16 ) ,
6868 React = __webpack_require__ ( 12 ) ,
6969 CalendarContainer = __webpack_require__ ( 17 )
70- ;
70+ ;
7171
7272 var TYPES = PropTypes ;
7373 var Datetime = createClass ( {
@@ -129,7 +129,7 @@ return /******/ (function(modules) { // webpackBootstrap
129129 var formats = this . getFormats ( props ) ,
130130 date = props . value || props . defaultValue ,
131131 selectedDate , viewDate , updateOn , inputValue
132- ;
132+ ;
133133
134134 if ( date && typeof date === 'string' )
135135 selectedDate = this . localMoment ( date , formats . datetime ) ;
@@ -164,7 +164,7 @@ return /******/ (function(modules) { // webpackBootstrap
164164 } ,
165165
166166 getUpdateOn : function ( formats ) {
167- if ( formats . date . match ( / [ l L D ] / ) ) {
167+ if ( formats . date . match ( / [ l L D ] / ) ) {
168168 return 'days' ;
169169 } else if ( formats . date . indexOf ( 'M' ) !== - 1 ) {
170170 return 'months' ;
@@ -181,7 +181,7 @@ return /******/ (function(modules) { // webpackBootstrap
181181 time : props . timeFormat || ''
182182 } ,
183183 locale = this . localMoment ( props . date , null , props ) . localeData ( )
184- ;
184+ ;
185185
186186 if ( formats . date === true ) {
187187 formats . date = locale . longDateFormat ( 'L' ) ;
@@ -253,15 +253,21 @@ return /******/ (function(modules) { // webpackBootstrap
253253 }
254254 }
255255 }
256-
256+ //we should only show a valid date if we are provided a isValidDate function.
257+ if ( this . props . isValidDate ) {
258+ updatedState . viewDate = updatedState . viewDate || this . state . viewDate ;
259+ while ( ! this . props . isValidDate ( updatedState . viewDate ) ) {
260+ updatedState . viewDate = updatedState . viewDate . add ( 1 , 'day' ) ;
261+ }
262+ }
257263 this . setState ( updatedState ) ;
258264 } ,
259265
260266 onInputChange : function ( e ) {
261267 var value = e . target === null ? e : e . target . value ,
262268 localMoment = this . localMoment ( value , this . state . inputFormat ) ,
263269 update = { inputValue : value }
264- ;
270+ ;
265271
266272 if ( localMoment . isValid ( ) && ! this . props . value ) {
267273 update . selectedDate = localMoment ;
@@ -333,7 +339,7 @@ return /******/ (function(modules) { // webpackBootstrap
333339 state = this . state ,
334340 date = ( state . selectedDate || state . viewDate ) . clone ( ) ,
335341 nextType
336- ;
342+ ;
337343
338344 // It is needed to set all the time properties
339345 // to not to reset the time
@@ -358,7 +364,7 @@ return /******/ (function(modules) { // webpackBootstrap
358364 viewDate = this . state . viewDate ,
359365 currentDate = this . state . selectedDate || viewDate ,
360366 date
361- ;
367+ ;
362368
363369 if ( target . className . indexOf ( 'rdtDay' ) !== - 1 ) {
364370 if ( target . className . indexOf ( 'rdtNew' ) !== - 1 )
@@ -447,7 +453,7 @@ return /******/ (function(modules) { // webpackBootstrap
447453 var me = this ,
448454 formats = this . getFormats ( this . props ) ,
449455 props = { dateFormat : formats . date , timeFormat : formats . time }
450- ;
456+ ;
451457
452458 this . componentProps . fromProps . forEach ( function ( name ) {
453459 props [ name ] = me . props [ name ] ;
@@ -463,11 +469,12 @@ return /******/ (function(modules) { // webpackBootstrap
463469 } ,
464470
465471 render : function ( ) {
472+ // TODO: Make a function or clean up this code,
473+ // logic right now is really hard to follow
466474 var className = 'rdt' + ( this . props . className ?
467475 ( Array . isArray ( this . props . className ) ?
468476 ' ' + this . props . className . join ( ' ' ) : ' ' + this . props . className ) : '' ) ,
469- children = [ ]
470- ;
477+ children = [ ] ;
471478
472479 if ( this . props . input ) {
473480 children = [ React . createElement ( 'input' , assign ( {
@@ -2674,12 +2681,12 @@ return /******/ (function(modules) { // webpackBootstrap
26742681 'use strict' ;
26752682
26762683 var React = __webpack_require__ ( 12 ) ,
2677- createClass = __webpack_require__ ( 11 ) ,
2678- DaysView = __webpack_require__ ( 18 ) ,
2679- MonthsView = __webpack_require__ ( 21 ) ,
2680- YearsView = __webpack_require__ ( 22 ) ,
2681- TimeView = __webpack_require__ ( 23 )
2682- ;
2684+ createClass = __webpack_require__ ( 11 ) ,
2685+ DaysView = __webpack_require__ ( 18 ) ,
2686+ MonthsView = __webpack_require__ ( 21 ) ,
2687+ YearsView = __webpack_require__ ( 22 ) ,
2688+ TimeView = __webpack_require__ ( 23 )
2689+ ;
26832690
26842691 var CalendarContainer = createClass ( {
26852692 viewComponents : {
@@ -2689,9 +2696,9 @@ return /******/ (function(modules) { // webpackBootstrap
26892696 time : TimeView
26902697 } ,
26912698
2692- render : function ( ) {
2693- return React . createElement ( this . viewComponents [ this . props . view ] , this . props . viewProps ) ;
2694- }
2699+ render : function ( ) {
2700+ return React . createElement ( this . viewComponents [ this . props . view ] , this . props . viewProps ) ;
2701+ }
26952702 } ) ;
26962703
26972704 module . exports = CalendarContainer ;
@@ -2704,18 +2711,18 @@ return /******/ (function(modules) { // webpackBootstrap
27042711 'use strict' ;
27052712
27062713 var React = __webpack_require__ ( 12 ) ,
2707- createClass = __webpack_require__ ( 11 ) ,
2714+ createClass = __webpack_require__ ( 11 ) ,
27082715 moment = __webpack_require__ ( 16 ) ,
27092716 onClickOutside = __webpack_require__ ( 19 )
2710- ;
2717+ ;
27112718
27122719 var DateTimePickerDays = onClickOutside ( createClass ( {
27132720 render : function ( ) {
27142721 var footer = this . renderFooter ( ) ,
27152722 date = this . props . viewDate ,
27162723 locale = date . localeData ( ) ,
27172724 tableChildren
2718- ;
2725+ ;
27192726
27202727 tableChildren = [
27212728 React . createElement ( 'thead' , { key : 'th' } , [
@@ -2747,7 +2754,7 @@ return /******/ (function(modules) { // webpackBootstrap
27472754 first = locale . firstDayOfWeek ( ) ,
27482755 dow = [ ] ,
27492756 i = 0
2750- ;
2757+ ;
27512758
27522759 days . forEach ( function ( day ) {
27532760 dow [ ( 7 + ( i ++ ) - first ) % 7 ] = day ;
@@ -2767,7 +2774,7 @@ return /******/ (function(modules) { // webpackBootstrap
27672774 renderer = this . props . renderDay || this . renderDay ,
27682775 isValid = this . props . isValidDate || this . alwaysValidDate ,
27692776 classes , isDisabled , dayProps , currentDate
2770- ;
2777+ ;
27712778
27722779 // Go to the last week of the previous month
27732780 prevMonth . date ( prevMonth . daysInMonth ( ) ) . startOf ( 'week' ) ;
@@ -2839,9 +2846,9 @@ return /******/ (function(modules) { // webpackBootstrap
28392846 return 1 ;
28402847 } ,
28412848
2842- handleClickOutside : function ( ) {
2843- this . props . handleClickOutside ( ) ;
2844- }
2849+ handleClickOutside : function ( ) {
2850+ this . props . handleClickOutside ( ) ;
2851+ }
28452852 } ) ) ;
28462853
28472854 module . exports = DateTimePickerDays ;
@@ -3175,9 +3182,9 @@ return /******/ (function(modules) { // webpackBootstrap
31753182 'use strict' ;
31763183
31773184 var React = __webpack_require__ ( 12 ) ,
3178- createClass = __webpack_require__ ( 11 ) ,
3185+ createClass = __webpack_require__ ( 11 ) ,
31793186 onClickOutside = __webpack_require__ ( 19 )
3180- ;
3187+ ;
31813188
31823189 var DateTimePickerMonths = onClickOutside ( createClass ( {
31833190 render : function ( ) {
@@ -3203,7 +3210,7 @@ return /******/ (function(modules) { // webpackBootstrap
32033210 classes , props , currentMonth , isDisabled , noOfDaysInMonth , daysInMonth , validDay ,
32043211 // Date is irrelevant because we're only interested in month
32053212 irrelevantDate = 1
3206- ;
3213+ ;
32073214
32083215 while ( i < 12 ) {
32093216 classes = 'rdtMonth' ;
@@ -3269,9 +3276,9 @@ return /******/ (function(modules) { // webpackBootstrap
32693276 return 1 ;
32703277 } ,
32713278
3272- handleClickOutside : function ( ) {
3273- this . props . handleClickOutside ( ) ;
3274- }
3279+ handleClickOutside : function ( ) {
3280+ this . props . handleClickOutside ( ) ;
3281+ }
32753282 } ) ) ;
32763283
32773284 function capitalize ( str ) {
@@ -3288,9 +3295,9 @@ return /******/ (function(modules) { // webpackBootstrap
32883295 'use strict' ;
32893296
32903297 var React = __webpack_require__ ( 12 ) ,
3291- createClass = __webpack_require__ ( 11 ) ,
3298+ createClass = __webpack_require__ ( 11 ) ,
32923299 onClickOutside = __webpack_require__ ( 19 )
3293- ;
3300+ ;
32943301
32953302 var DateTimePickerYears = onClickOutside ( createClass ( {
32963303 render : function ( ) {
@@ -3301,7 +3308,7 @@ return /******/ (function(modules) { // webpackBootstrap
33013308 React . createElement ( 'th' , { key : 'prev' , className : 'rdtPrev' , onClick : this . props . subtractTime ( 10 , 'years' ) } , React . createElement ( 'span' , { } , '‹' ) ) ,
33023309 React . createElement ( 'th' , { key : 'year' , className : 'rdtSwitch' , onClick : this . props . showView ( 'years' ) , colSpan : 2 } , year + '-' + ( year + 9 ) ) ,
33033310 React . createElement ( 'th' , { key : 'next' , className : 'rdtNext' , onClick : this . props . addTime ( 10 , 'years' ) } , React . createElement ( 'span' , { } , '›' ) )
3304- ] ) ) ) ,
3311+ ] ) ) ) ,
33053312 React . createElement ( 'table' , { key : 'years' } , React . createElement ( 'tbody' , { } , this . renderYears ( year ) ) )
33063313 ] ) ;
33073314 } ,
@@ -3318,7 +3325,7 @@ return /******/ (function(modules) { // webpackBootstrap
33183325 // we're only interested in the year
33193326 irrelevantMonth = 0 ,
33203327 irrelevantDate = 1
3321- ;
3328+ ;
33223329
33233330 year -- ;
33243331 while ( i < 11 ) {
@@ -3384,9 +3391,9 @@ return /******/ (function(modules) { // webpackBootstrap
33843391 return 1 ;
33853392 } ,
33863393
3387- handleClickOutside : function ( ) {
3388- this . props . handleClickOutside ( ) ;
3389- }
3394+ handleClickOutside : function ( ) {
3395+ this . props . handleClickOutside ( ) ;
3396+ }
33903397 } ) ) ;
33913398
33923399 module . exports = DateTimePickerYears ;
@@ -3399,10 +3406,10 @@ return /******/ (function(modules) { // webpackBootstrap
33993406 'use strict' ;
34003407
34013408 var React = __webpack_require__ ( 12 ) ,
3402- createClass = __webpack_require__ ( 11 ) ,
3409+ createClass = __webpack_require__ ( 11 ) ,
34033410 assign = __webpack_require__ ( 1 ) ,
3404- onClickOutside = __webpack_require__ ( 19 )
3405- ;
3411+ onClickOutside = __webpack_require__ ( 19 )
3412+ ;
34063413
34073414 var DateTimePickerTime = onClickOutside ( createClass ( {
34083415 getInitialState : function ( ) {
@@ -3413,7 +3420,7 @@ return /******/ (function(modules) { // webpackBootstrap
34133420 var date = props . selectedDate || props . viewDate ,
34143421 format = props . timeFormat ,
34153422 counters = [ ]
3416- ;
3423+ ;
34173424
34183425 if ( format . toLowerCase ( ) . indexOf ( 'h' ) !== - 1 ) {
34193426 counters . push ( 'hours' ) ;
@@ -3618,9 +3625,9 @@ return /******/ (function(modules) { // webpackBootstrap
36183625 return str ;
36193626 } ,
36203627
3621- handleClickOutside : function ( ) {
3622- this . props . handleClickOutside ( ) ;
3623- }
3628+ handleClickOutside : function ( ) {
3629+ this . props . handleClickOutside ( ) ;
3630+ }
36243631 } ) ) ;
36253632
36263633 module . exports = DateTimePickerTime ;
0 commit comments