Skip to content

Commit 54648f8

Browse files
committed
requested changes
1 parent 1797cd7 commit 54648f8

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/controls/dateTimePicker/DateTimePicker.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { isEqual } from '@microsoft/sp-lodash-subset';
33
import { TimeConvention, DateConvention } from "./DateTimeConventions";
44
import { DatePicker } from "office-ui-fabric-react/lib/DatePicker";
55
import { Label } from "office-ui-fabric-react/lib/Label";
6-
import { IDropdownOption } from "office-ui-fabric-react/lib/Dropdown";
7-
import * as strings from "ControlStrings";
86
import ErrorMessage from "../errorMessage/ErrorMessage";
97
import styles from "./DateTimePicker.module.scss";
108
import HoursComponent from "./HoursComponent";
@@ -15,7 +13,6 @@ import { Async, css } from 'office-ui-fabric-react/lib/Utilities';
1513
import { IDateTimePickerProps, IDateTimePickerState, DateTimePickerStrings } from ".";
1614
import { TimeHelper } from "./TimeHelper";
1715
import { TimeDisplayControlType } from "./TimeDisplayControlType";
18-
import { addMonths, addYears } from 'office-ui-fabric-react/lib/utilities/dateMath/DateMath';
1916

2017
interface IDateComponents {
2118
day: Date;
@@ -54,8 +51,7 @@ export class DateTimePicker extends React.Component<IDateTimePickerProps, IDateT
5451
hours,
5552
minutes,
5653
seconds,
57-
errorMessage: '',
58-
today: new Date(Date.now())
54+
errorMessage: ''
5955
};
6056

6157
this.async = new Async(this);
@@ -208,8 +204,8 @@ export class DateTimePicker extends React.Component<IDateTimePickerProps, IDateT
208204
timeDisplayControlType,
209205
placeholder,
210206
showLabels,
211-
minDate = addYears(this.state.today, 1),
212-
maxDate = addYears(this.state.today, 1)
207+
minDate,
208+
maxDate
213209
} = this.props;
214210

215211
const hours: number = value != null ? value.getHours() : this.state.hours;

src/controls/dateTimePicker/IDateTimePickerState.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ export interface IDateTimePickerState {
77
minutes?: number;
88
seconds?: number;
99
errorMessage?: string;
10-
today: Date;
1110
}

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,14 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
605605
<DateTimePicker label="DateTime Picker no seconds" value={new Date()} onChange={(value) => console.log("DateTimePicker value:", value)} />
606606
<DateTimePicker label="DateTime Picker (unspecified = date and time)" timeConvention={TimeConvention.Hours24} value={new Date()} onChange={(value) => console.log("DateTimePicker value:", value)} />
607607
<DateTimePicker label="DateTime Picker dropdown" showSeconds={true} timeDisplayControlType={TimeDisplayControlType.Dropdown} value={new Date()} onChange={(value) => console.log("DateTimePicker value:", value)} />
608-
<DateTimePicker label="DateTime Picker date only" showLabels={false} dateConvention={DateConvention.Date} value={new Date()} onChange={(value) => console.log("DateTimePicker value:", value)} />
608+
<DateTimePicker
609+
label="DateTime Picker date only"
610+
showLabels={false}
611+
dateConvention={DateConvention.Date}
612+
value={new Date()}
613+
onChange={(value) => console.log("DateTimePicker value:", value)}
614+
minDate={new Date("05/01/2019")}
615+
maxDate={new Date("05/01/2020")} />
609616

610617
{/* <RichText isEditMode={this.props.displayMode === DisplayMode.Edit} onChange={value => { this.richTextValue = value; return value; }} /> */}
611618
<RichText isEditMode={this.props.displayMode === DisplayMode.Edit} onChange={value => { this.setState({ richTextValue: value }); return value; }} />

0 commit comments

Comments
 (0)