Skip to content

Commit 9d129b3

Browse files
committed
Changed react version and removed defaultStartDate and defaultEndDate.
1 parent 59b6c18 commit 9d129b3

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ Almost all the props available for [react-datetime](https://github.com/YouCanBoo
3333

3434
| Name | Type | Default | Description |
3535
|------|------|---------|-------------|
36-
| defaultStartDate | `Date` | `new Date()` | This sets the default/initial start date |
37-
| defaultEndDate | `Date` | `new Date()` | This sets the default/initial end date |
38-
| startDate | `Date` | `new Date()` | This sets a new value for the start date |
39-
| endDate | `Date` | `new Date()` | This sets a new value for the end date |
36+
| startDate | `Date` | `new Date()` | This sets a value for the start date |
37+
| endDate | `Date` | `new Date()` | This sets a value for the end date |
4038
| dateFormat | `Boolean` or `String` | `true` | Defines the format for the date. It accepts any `Moment` date format (not in localized format). If `true` the date will be displayed using the defaults for the current `locale`. If `false` the datepicker is disabled and the component can be used as timepicker. |
4139
| timeFormat | `Boolean` or `String` | `true` | Defines the format for the time. It accepts any `Moment` time format (not in localized format). If `true` the time will be displayed using the defaults for the current `locale`. If `false` the timepicker is disabled and the component can be used as datepicker. |
4240
| utc | `boolean` | `false` | When true, start and end time values will be interpreted as UTC. Otherwise they will default to the user's local timezone. |

lib/index.jsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ class DatetimeRangePicker extends Component {
1313
super(props);
1414

1515
this.state = {
16-
start: moment(props.startDate) || moment(),
17-
end: moment(props.endDate) || moment(),
18-
startDate: props.startDate,
19-
endDate: props.endDate,
16+
start: null,
17+
end: null,
18+
startDate: null,
19+
endDate: null,
2020
};
2121
}
2222

2323
static getDerivedStateFromProps(nextProps, prevState) {
2424
return nextProps.startDate === prevState.startDate && nextProps.endDate === prevState.endDate
2525
? {}
2626
: {
27-
start: moment(nextProps.startDate),
28-
end: moment(nextProps.endDate),
27+
start: moment(nextProps.startDate) || moment(),
28+
end: moment(nextProps.endDate) || moment(),
2929
startDate: nextProps.startDate,
3030
endDate: nextProps.endDate,
3131
}
@@ -79,7 +79,6 @@ class DatetimeRangePicker extends Component {
7979
return {
8080
...baseProps,
8181
...inputProps,
82-
defaultValue: this.props.defaultStartDate,
8382
value: this.state.start,
8483
onBlur: this.props.onStartDateBlur,
8584
onFocus: this.props.onStartDateFocus,
@@ -95,7 +94,6 @@ class DatetimeRangePicker extends Component {
9594
...baseProps,
9695
...inputProps,
9796
onBlur: this.props.onEndDateBlur,
98-
defaultValue: this.props.defaultEndDate,
9997
value: this.state.end,
10098
onFocus: this.props.onEndDateFocus,
10199
timeConstraints: this.props.endTimeConstraints,

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-datetime-range-picker",
3-
"description": "Resusable date time range picker",
4-
"version": "1.0.6",
3+
"description": "Reusable date time range picker",
4+
"version": "1.0.7",
55
"author": "Samuel Amoah <sa.am@programmer.net>",
66
"repository": {
77
"type": "git",
@@ -37,7 +37,7 @@
3737
"prop-types": "^15.5.10"
3838
},
3939
"peerDependencies": {
40-
"react": "^15.6.1",
40+
"react": "^16.3.0",
4141
"react-datetime": "^2.8.10"
4242
},
4343
"scripts": {

0 commit comments

Comments
 (0)