Skip to content

Commit d5a8519

Browse files
committed
Added multi select support
1 parent 2a83208 commit d5a8519

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

DateTime.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var Datetime = createClass({
4747

4848
getInitialState: function() {
4949
this.checkTZ( this.props );
50-
50+
5151
var state = this.getStateFromProps( this.props );
5252

5353
if ( state.open === undefined )
@@ -74,6 +74,7 @@ var Datetime = createClass({
7474
},
7575

7676
getStateFromProps: function( props ) {
77+
7778
var formats = this.getFormats( props ),
7879
date = props.value || props.defaultValue,
7980
selectedDate, viewDate, updateOn, inputValue
@@ -216,6 +217,7 @@ var Datetime = createClass({
216217
},
217218

218219
onInputChange: function( e ) {
220+
219221
var value = e.target === null ? e : e.target.value,
220222
localMoment = this.localMoment( value, this.state.inputFormat ),
221223
update = { inputValue: value }
@@ -229,7 +231,8 @@ var Datetime = createClass({
229231
}
230232

231233
return this.setState( update, function() {
232-
return this.props.onChange( localMoment.isValid() ? localMoment : this.state.inputValue );
234+
return this.props.onChange( localMoment.isValid() ? localMoment : this.state.inputValue
235+
);
233236
});
234237
},
235238

@@ -310,6 +313,7 @@ var Datetime = createClass({
310313
inputValue: date.format( state.inputFormat )
311314
});
312315
}
316+
313317
this.props.onChange( date );
314318
},
315319

@@ -321,6 +325,8 @@ var Datetime = createClass({
321325
date
322326
;
323327

328+
const ctrlPressed = !!e.ctrlKey;
329+
324330
if (target.className.indexOf('rdtDay') !== -1) {
325331
if (target.className.indexOf('rdtNew') !== -1)
326332
modifier = 1;
@@ -364,7 +370,7 @@ var Datetime = createClass({
364370
}
365371
}
366372

367-
this.props.onChange( date );
373+
this.props.onChange( date, ctrlPressed );
368374
},
369375

370376
openCalendar: function( e ) {
@@ -416,7 +422,7 @@ var Datetime = createClass({
416422
},
417423

418424
componentProps: {
419-
fromProps: ['value', 'isValidDate', 'renderDay', 'renderMonth', 'renderYear', 'timeConstraints'],
425+
fromProps: ['value', 'multiValue', 'isValidDate', 'renderDay', 'renderMonth', 'renderYear', 'timeConstraints'],
420426
fromState: ['viewDate', 'selectedDate', 'updateOn'],
421427
fromThis: ['setDate', 'setTime', 'showView', 'addTime', 'subtractTime', 'updateSelectedDate', 'localMoment', 'handleClickOutside']
422428
},

src/DaysView.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ var DateTimePickerDays = createClass({
5353
},
5454

5555
renderDays: function() {
56+
5657
var date = this.props.viewDate,
5758
selected = this.props.selectedDate && this.props.selectedDate.clone(),
5859
prevMonth = date.clone().subtract( 1, 'months' ),
@@ -91,7 +92,8 @@ var DateTimePickerDays = createClass({
9192
dayProps = {
9293
key: prevMonth.format( 'M_D' ),
9394
'data-value': prevMonth.date(),
94-
className: classes
95+
className: classes,
96+
fullProps: this.props,
9597
};
9698

9799
if ( !isDisabled )

0 commit comments

Comments
 (0)