Skip to content

Commit 300c0c4

Browse files
committed
Merge pull request quri#127 from alfonsoperez/master
fix linting errors
2 parents d9d20b8 + 270d80f commit 300c0c4

9 files changed

+39
-37
lines changed

examples/basic/ParentComponent.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React, { Component } from "react";
2+
import DateTimeField from "react-bootstrap-datetimepicker";
3+
4+
class ParentComponent extends Component {
5+
constructor(props) {
6+
super(props);
7+
this.state = {
8+
date: "1990-06-05",
9+
format: "YYYY-MM-DD",
10+
inputFormat: "DD/MM/YYYY",
11+
mode: "date"
12+
};
13+
}
14+
15+
handleChange = (newDate) => {
16+
console.log("newDate", newDate);
17+
return this.setState({date: newDate});
18+
}
19+
20+
render() {
21+
const {date, format, mode, inputFormat} = this.state;
22+
return (<DateTimeField
23+
dateTime={date}
24+
format={format}
25+
inputFormat={inputFormat}
26+
onChange={this.handleChange}
27+
viewMode={mode}
28+
/>);
29+
}
30+
}
31+
32+
module.exports = ParentComponent;

examples/basic/basic.js

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,7 @@ import React, { Component } from "react";
22
import ReactDOM from "react-dom";
33
import DateTimeField from "react-bootstrap-datetimepicker";
44
import moment from "moment";
5-
6-
class ParentComponent extends Component {
7-
constructor(props) {
8-
super(props);
9-
this.state = {
10-
date: "1990-06-05",
11-
format: "YYYY-MM-DD",
12-
inputFormat: "DD/MM/YYYY",
13-
mode: "date"
14-
};
15-
}
16-
17-
handleChange = (newDate) => {
18-
console.log("newDate", newDate);
19-
return this.setState({date: newDate});
20-
}
21-
22-
render() {
23-
const {date, format, mode, inputFormat} = this.state;
24-
return <DateTimeField
25-
dateTime={date}
26-
format={format}
27-
viewMode={mode}
28-
inputFormat={inputFormat}
29-
onChange={this.handleChange}
30-
/>;
31-
}
32-
}
5+
import ParentComponent from "./ParentComponent";
336

347
class Basic extends Component {
358

@@ -156,6 +129,4 @@ class Basic extends Component {
156129
}
157130
}
158131

159-
160-
161132
ReactDOM.render(React.createFactory(Basic)(), document.getElementById("example"));

src/DateTimeField.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { Component, PropTypes } from "react";
2-
import {findDOMNode} from "react-dom";
32
import moment from "moment";
43
import classnames from "classnames";
54
import DateTimePicker from "./DateTimePicker.js";

src/DateTimePicker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export default class DateTimePicker extends Component {
9292
return this.props.mode === Constants.MODE_DATETIME ?
9393
(
9494
<li>
95-
<span className="btn picker-switch" style={{width: "100%"}} onClick={this.props.togglePicker}><span className={classnames("glyphicon", this.props.showTimePicker ? "glyphicon-calendar" : "glyphicon-time")} /></span>
95+
<span className="btn picker-switch" onClick={this.props.togglePicker} style={{width: "100%"}} ><span className={classnames("glyphicon", this.props.showTimePicker ? "glyphicon-calendar" : "glyphicon-time")} /></span>
9696
</li>
9797
) :
9898
null;

src/DateTimePickerDays.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default class DateTimePickerDays extends Component {
5757
classes.disabled = true;
5858
}
5959
if (this.props.daysOfWeekDisabled.length > 0) classes.disabled = this.props.daysOfWeekDisabled.indexOf(prevMonth.day()) !== -1;
60-
cells.push(<td key={prevMonth.month() + "-" + prevMonth.date()} className={classnames(classes)} onClick={this.props.setSelectedDate}>{prevMonth.date()}</td>);
60+
cells.push(<td className={classnames(classes)} key={prevMonth.month() + "-" + prevMonth.date()} onClick={this.props.setSelectedDate}>{prevMonth.date()}</td>);
6161
if (prevMonth.weekday() === moment().endOf("week").weekday()) {
6262
row = <tr key={prevMonth.month() + "-" + prevMonth.date()}>{cells}</tr>;
6363
html.push(row);

src/DateTimePickerHours.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default class DateTimePickerHours extends Component {
1313
(
1414
<ul className="list-unstyled">
1515
<li>
16-
<span className="btn picker-switch" style={{width: "100%"}} onClick={this.props.onSwitch}><span className="glyphicon glyphicon-time" /></span>
16+
<span className="btn picker-switch" onClick={this.props.onSwitch} style={{width: "100%"}} ><span className="glyphicon glyphicon-time" /></span>
1717
</li>
1818
</ul>
1919
) :

src/DateTimePickerMinutes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default class DateTimePickerMinutes extends Component {
1313
(
1414
<ul className="list-unstyled">
1515
<li>
16-
<span className="btn picker-switch" style={{width: "100%"}} onClick={this.props.onSwitch}><span className="glyphicon glyphicon-time" /></span>
16+
<span className="btn picker-switch" onClick={this.props.onSwitch} style={{width: "100%"}}><span className="glyphicon glyphicon-time" /></span>
1717
</li>
1818
</ul>
1919
) :

src/DateTimePickerMonths.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class DateTimePickerMonths extends Component {
2323
month: true,
2424
"active": i === month && this.props.viewDate.year() === this.props.selectedDate.year()
2525
};
26-
months.push(<span key={i} className={classnames(classes)} onClick={this.props.setViewMonth}>{monthsShort[i]}</span>);
26+
months.push(<span className={classnames(classes)} key={i} onClick={this.props.setViewMonth}>{monthsShort[i]}</span>);
2727
i++;
2828
}
2929
return months;

src/DateTimePickerYears.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class DateTimePickerYears extends Component {
2222
old: i === -1 | i === 10,
2323
active: this.props.selectedDate.year() === year
2424
};
25-
years.push(<span key={year} className={classnames(classes)} onClick={this.props.setViewYear}>{year}</span>);
25+
years.push(<span className={classnames(classes)} key={year}onClick={this.props.setViewYear}>{year}</span>);
2626
year++;
2727
i++;
2828
}

0 commit comments

Comments
 (0)