Skip to content

Commit 0f072bd

Browse files
committed
Added const/let
1 parent fc3622d commit 0f072bd

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/CustomDatePickerAndroid/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,13 @@ export default class CustomDatePickerAndroid extends Component {
9191
if (action !== TimePickerAndroid.dismissedAction) {
9292
let date;
9393
if (this.props.date) {
94-
// this prevents losing the Date elements
95-
// not sure if this check if necessary; based on date picker above
96-
year = moment(this.props.date).year();
97-
month = moment(this.props.date).month();
98-
day = moment(this.props.date).date();
99-
date = moment({year, month, day, hour, minute}).toDate();
94+
// This prevents losing the Date elements, see issue #71
95+
const year = moment(this.props.date).year();
96+
const month = moment(this.props.date).month();
97+
const day = moment(this.props.date).date();
98+
date = moment({ year, month, day, hour, minute }).toDate();
10099
} else {
101-
date = moment({hour, minute}).toDate();
100+
date = moment({ hour, minute }).toDate();
102101
}
103102
this.props.onConfirm(date);
104103
this.props.onHideAfterConfirm(date);

0 commit comments

Comments
 (0)