Skip to content

Commit 20205e9

Browse files
committed
fix of #799
1 parent 86d86a7 commit 20205e9

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/controls/dateTimePicker/DateTimePicker.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class DateTimePicker extends React.Component<IDateTimePickerProps, IDateT
6969
* Called before the component receives new props, used for matching state with new props.
7070
*/
7171
public componentWillReceiveProps(nextProps: IDateTimePickerProps): void {
72-
if (nextProps.value != null && !isEqual(nextProps.value, this.props.value)) {
72+
if (!isEqual(nextProps.value, this.props.value)) {
7373
const { day, hours, minutes, seconds } = DateTimePicker.getDateComponents(nextProps.value, this.props.dateConvention);
7474
this.setState({ day, hours, minutes, seconds });
7575
}
@@ -134,9 +134,9 @@ export class DateTimePicker extends React.Component<IDateTimePickerProps, IDateT
134134
}
135135
}
136136
else if (hours === 12) {
137-
//am - if hours == 12, set hours to 0 here
138-
hours = 0;
139-
}
137+
//am - if hours == 12, set hours to 0 here
138+
hours = 0;
139+
}
140140
}
141141

142142
if (hours > 23) {

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,13 +1121,10 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
11211121
showSeconds={true}
11221122
timeDisplayControlType={TimeDisplayControlType.Dropdown}
11231123
/>
1124-
<PrimaryButton text={'Change Date'} onClick={() => {
1125-
const date = this.state.dateTimeValue || new Date();
1126-
date.setMinutes(50);
1127-
date.setHours(11);
1128-
date.setSeconds(12);
1124+
<PrimaryButton text={'Clear Date'} onClick={() => {
1125+
11291126
this.setState({
1130-
dateTimeValue: date
1127+
dateTimeValue: undefined
11311128
});
11321129
}} />
11331130

0 commit comments

Comments
 (0)