Skip to content

Commit f09efe6

Browse files
author
Wojciech Maj
committed
Minor styling and formatting
1 parent c11349a commit f09efe6

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/DateTimePicker.jsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -248,21 +248,21 @@ export default class DateTimePicker extends PureComponent {
248248
}
249249

250250
renderClock() {
251+
const { disableClock} = this.props;
251252
const { isClockOpen } = this.state;
252253

254+
if (isClockOpen === null || disableClock) {
255+
return null;
256+
}
257+
253258
const {
254259
clockClassName,
255260
className: timePickerClassName, // Unused, here to exclude it from clockProps
256261
maxDetail,
257262
onChange,
258-
disableClock,
259263
...clockProps
260264
} = this.props;
261265

262-
if (isClockOpen === null || disableClock) {
263-
return null;
264-
}
265-
266266
const className = 'react-datetime-picker__clock';
267267

268268
const maxDetailIndex = allViews.indexOf(maxDetail);
@@ -342,12 +342,11 @@ const ClearIcon = (
342342
);
343343

344344
DateTimePicker.defaultProps = {
345-
clearIcon: ClearIcon,
346345
calendarIcon: CalendarIcon,
346+
clearIcon: ClearIcon,
347347
isCalendarOpen: null,
348348
isClockOpen: null,
349349
maxDetail: 'minute',
350-
disableClock: false,
351350
};
352351

353352
DateTimePicker.propTypes = {
@@ -357,22 +356,22 @@ DateTimePicker.propTypes = {
357356
PropTypes.string,
358357
PropTypes.arrayOf(PropTypes.string),
359358
]),
360-
clockClassName: PropTypes.oneOfType([
361-
PropTypes.string,
362-
PropTypes.arrayOf(PropTypes.string),
363-
]),
364359
calendarIcon: PropTypes.node,
365360
className: PropTypes.oneOfType([
366361
PropTypes.string,
367362
PropTypes.arrayOf(PropTypes.string),
368363
]),
369364
clearIcon: PropTypes.node,
365+
clockClassName: PropTypes.oneOfType([
366+
PropTypes.string,
367+
PropTypes.arrayOf(PropTypes.string),
368+
]),
370369
disabled: PropTypes.bool,
370+
disableClock: PropTypes.bool,
371371
isCalendarOpen: PropTypes.bool,
372372
isClockOpen: PropTypes.bool,
373-
maxDetail: PropTypes.oneOf(allViews),
374-
disableClock: PropTypes.bool,
375373
maxDate: isMaxDate,
374+
maxDetail: PropTypes.oneOf(allViews),
376375
minDate: isMinDate,
377376
name: PropTypes.string,
378377
onChange: PropTypes.func,

0 commit comments

Comments
 (0)