Skip to content

Commit 2583af8

Browse files
robertobattsmartijnrusschen
authored andcommitted
Fix custominput parent classname (Hacker0x01#1835)
* append className instead of overriding * fix css customInput
1 parent 1f50f12 commit 2583af8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/index.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ export default class DatePicker extends React.Component {
246246
this.props.openToDate
247247
? this.props.openToDate
248248
: this.props.selectsEnd && this.props.startDate
249-
? this.props.startDate
250-
: this.props.selectsStart && this.props.endDate
251-
? this.props.endDate
252-
: newDate();
249+
? this.props.startDate
250+
: this.props.selectsStart && this.props.endDate
251+
? this.props.endDate
252+
: newDate();
253253

254254
calcInitialState = () => {
255255
const defaultPreSelection = this.getPreSelection();
@@ -259,8 +259,8 @@ export default class DatePicker extends React.Component {
259259
minDate && isBefore(defaultPreSelection, minDate)
260260
? minDate
261261
: maxDate && isAfter(defaultPreSelection, maxDate)
262-
? maxDate
263-
: defaultPreSelection;
262+
? maxDate
263+
: defaultPreSelection;
264264
return {
265265
open: this.props.startOpen || false,
266266
preventFocus: false,
@@ -703,8 +703,8 @@ export default class DatePicker extends React.Component {
703703
typeof this.props.value === "string"
704704
? this.props.value
705705
: typeof this.state.inputValue === "string"
706-
? this.state.inputValue
707-
: safeDateFormat(this.props.selected, this.props);
706+
? this.state.inputValue
707+
: safeDateFormat(this.props.selected, this.props);
708708

709709
return React.cloneElement(customInput, {
710710
[customInputRef]: input => {
@@ -722,7 +722,7 @@ export default class DatePicker extends React.Component {
722722
placeholder: this.props.placeholderText,
723723
disabled: this.props.disabled,
724724
autoComplete: this.props.autoComplete,
725-
className: className,
725+
className: customInput.props.className + " " + className,
726726
title: this.props.title,
727727
readOnly: this.props.readOnly,
728728
required: this.props.required,

0 commit comments

Comments
 (0)